Forum: Ruby on Rails SortHelper Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
592f24dbd34fa852d45b16ba42f35e59?d=identicon&s=25 Lloyd Christmas (Guest)
on 2006-03-31 20:59
(Received via mailing list)
I'm trying to install the SortHelper module, and for some reason I'm
getting a NoMethodError when I try to view the list. I'm a relative
newbie to rails, but the controller and the helper seem to be pointing
to the right places. I named the controller sort_controller.rb and the
helper is sort_helper.rb, and list is list.rhtml

Thanks for any help!

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
F0aea0642481aab7cb7851b6c9a10489?d=identicon&s=25 Dave Davidson (sp00nyg)
on 2006-04-01 00:51
(Received via mailing list)
Lloyd Christmas <plant_life@...> writes:

>
>
> I'm trying to install the SortHelper module, and for some reason I'm getting
a NoMethodError when I try to
> view the list. I'm a relative newbie to rails, but the controller and the
helper seem to be pointing to the
> right places. I named the controller sort_controller.rb and the helper is
sort_helper.rb, and list is list.rhtml
>

Typically, helpers are referenced in controllers where you want to
invoke them,
rather than in their own controller.  You utilize the helper, in this
case the
sort helper, by sticking a "helper :sort" at the top of the controller.

For example, if you have a controller that generates a collection of
"Widget"
models that you want to sort in the list view, you would put this at the
top of
widget_controller.rb...

  helper :sort
  include SortHelper

...and then you would get all the methods provided by the sort_helper.rb
module.  I got bit by this  myself, hopefully this will solve your issue
too.
This topic is locked and can not be replied to.