Reputation: 24558
I need to do some thing like that:
class ApplicationController < ActionController::Base
authorize_resource :unless => :devise_controller?
...
But, if I try to click on sign-up link, I get:
NameError in Devise::SessionsController#new
uninitialized constant Session
How can I skip authorize_resource for all the actions of devise_controller ? or any class that inherits devise_controller ?
What if there are many controllers to exclude ?
Any help will be more than appreciated, I don't need to pass an instance, just the class name
Upvotes: 2
Views: 1756
Reputation: 32172
I do
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate_user!
# Don't let controllers get away with
# any monkey business
check_authorization :unless => :devise_controller?
end
and it works for me and I am using CANCAN with rails 3.2
Upvotes: 4