[Rails] Where to put methods used by views
Todd Breiholz
talanb at gmail.com
Tue Nov 2 17:03:43 GMT 2004
So how do you determine what goes in the controller vs. the helper?
Only view methods in the controllers?
Todd
On Tue, 02 Nov 2004 18:59:27 +0200, Alexey Verkhovsky <alex at verk.info> wrote:
> Marten Veldthuis wrote:
>
> >> Probably a dumb question, but where do I add a method so that
> >> I can access it from within a view?
> >
> >
> > In app/helpers/*.rb.
>
> That's a good choice if it is used by one view, or views that belong to
> the same controller.
> Method that is used by multiple views from multiple controllers belongs
> to abstract_helper.rb.
>
> Of course, in both cases you can extract it to a separate file, if it's
> worth it. In which case, the file's place is either in app/helpers or in
> lib.
>
> Alex
>
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
More information about the Rails
mailing list