I have a method defined in ApplicationController
:
def some_checking
...
end
And I would like to call it from within another controller. Eg:
class OtherController < ApplicationController
some_checking
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.