I defined a helper abc()
in annotations_helper.rb
. What do I have to do such that I can use this method in annotations_controller.rb
?
views:
33answers:
2
+1
A:
In general helpers are supposed to be "view helpers" and not called from controllers.
You probably want to put something like that in application_controller.rb
Mike Buckbee
2009-09-11 03:58:04
+1
A:
This is usually not a good practice to use a helper in your controllers. You should try to move the logic inside a model or if the logic is too generic, you should move that to lib/some_lib.rb
and include
that in your model to use.
However check out this blog post if you really want to do this. Don't forget to read the comments.
Waseem
2009-09-11 04:21:54