Reputation: 89373
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
?
Upvotes: 0
Views: 161
Reputation: 8402
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.
Upvotes: 1
Reputation: 6993
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
Upvotes: 1