SortHelper Question


#1

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!


#2

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.