How to call a method in ApplicationController?
I have a method defined in ApplicationController
:
def some_checking
...
end
And I would like to call it from within another controller. E.g.:
class OtherController < ApplicationController
some_chec开发者_Python百科king
def xxx
end
end
How can I accomplish this? I just can't get into some_checking
.
I'm not quite sure on what you want to do. If I've understood you've defined a method on ApplicationController and you want it to be called inside OtherController. To do this you can both use before_filter
or just call the method from inside the xxx
method itself.
Take a look to available filters here http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html
精彩评论