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 ApplicationController
you write
before_filter :authorize
So that by definition all access is authorized. In your UsersController
you can then add an exception:
skip_before_filter :authorize, :only => [:index, :show, :different_controller_method]
Hope this helps.