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!


On 10/08/2011, at 10:39 AM, Bruno Meira <[email protected]> wrote:

> 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?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to