我需要做一些这样的事情:
class ApplicationController < ActionController::Base
authorize_resource :unless => :devise_controller?
...
但是,如果我尝试点击注册链接,我会得到:
NameError in Devise::SessionsController#new
uninitialized constant Session
如何跳过authorize_resource以获取devise_controller的所有操作?或任何继承devise_controller的类?
如果要排除多个控制器怎么办?
任何帮助都不仅仅是赞赏,我不需要传递实例,只需要传递类名
答案 0 :(得分:4)
我做
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
它适用于我,我正在使用带有rails 3.2的CANCAN