I want to declare some methods from a different controller in ApplicationController‘s filter like below:
In ApplicationContoller
before_filter :authorize, :except => [:index, :show, :different_controller_method]
where :different_controller_method is defined in UserController. Can we do this?
Normally this should work. Make sure you are using symbols, as @jdl is saying.
Most of the times we use a different approach though. In your
ApplicationControlleryou writeSo that by definition all access is authorized. In your
UsersControlleryou can then add an exception:Hope this helps.