错误:
NameError (uninitialized constant Ability::Invitation):
app/models/ability.rb:72:in `initialize'
app/controllers/invitations_controller.rb:12:in `new'
app/controllers/invitations_controller.rb:12:in `current_ability'
app/middleware/flash_session_cookie_middleware.rb:14:in `call'
CanCan我有:
can :manage, Invitation
邀请函控制器中的:
before_filter:current_ability #CanCan load_and_authorize_resource #CanCan
def current_ability @current_ability || = Ability.new(current_user,nil) 端
应用程序的控制器:
#CanCan
def current_ability
@current_ability ||= Ability.new(current_user, nil) # since no group
end
路线:
resources :invitations
为什么CanCan不开心?感谢
答案 0 :(得分:9)
看起来您正在尝试引用未定义的类。 app/models/invitation.rb
是否有定义此Invitation
类的文件?