Helpers X Partial

Well, I was reading Agile Web Development book and one question
appeared in my head.
When exactly I use partial and when exactly I use helper. As the book
says we could create html code in a shared helper, so Why we need to
use partial or layout instead of on shared helper?

The partial contains reusable markup - implementation of layout code. A helper contains reusable functionality for the view in effort to keep the view succinct and free of embedded logic.

Helpers are used inside templates. They're used when there's more ruby that you want to use than HTML. Partials are also used inside templates. They're used when there's more HTML that you want to use than ruby.

So, for example, text_area is a built in helper method because it takes parameters and spits out very customised HTML. Partials are usually used for sections of your web app interface you want to reuse on some pages... They'd look very ugly when written into a helper method. It's a matter of aesthetics.

Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
New video up now at http://sensei.zenunit.com/
real fastcgi rails deploy process! Check it out now!

now I understand
Thx ;D