I want to use a method i have in my helper inside my controller. I don't know how to use the view_context which i've heard could do the trick
Asked
Active
Viewed 292 times
1
-
2Generally, the opposite is made: controllers methods are used as helpers – apneadiving Jul 09 '11 at 21:02
2 Answers
3
As apneadiving said, make it a controller method and make that a helper method.
application_controller.rb
helper_method :do_stuff
def do_stuff
#this method is available in all controllers and views

mark
- 10,316
- 6
- 37
- 58
0
I vote for @apneadiving's idea. But here goes:
class SomeController < ApplicationController
include SomeHelper
end

jimworm
- 2,731
- 18
- 26