Ruby on Rails Tip: Using Controller Methods in Views 0
Posted Monday, February 19, 2007 20:32
Suppose you have a method in a controller that you want to use in a view. If you try to just invoke it as a helper, you’ll get a method not found error, because controller methods are out of scope for views.
You can, however, make any method available as a helper by simply declaring it as such in the controller:
helper_method :some_method_name, :another_method_name
The method must be in the same controller as the one that invoked the view.
