Alex Rivera | Logout

When to use Helpers instead of Partials

Asked 2008-12-30T01:42:21.277
46

In a rails application, in which situation would you use a partial and when would you use a helper? I find both very similar, since they represent markup fragments.

Is there a convention around this? which is the 'rails way' of using them?

Thanks!

Edit
Report

1 Answer

0

Partials are the part of view which can have bunch of HTML code along with ruby code. You can also use the partials in controller in render method.

In case of helpers, you can have methods for short html piece of code. You can have some calculations related methods which you want to use in your view file.

answered 2011-03-03T07:36:30.460

Your Answer