Rails 3 - CanCan 错误? NameError(未初始化常量Ability::Invitation):
错误:
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
在 Invitations Controller 中:
before_filter :current_ability # CanCan load_and_authorize_resource #CanCan
def current_ability @current_ability ||= Skill.new(current_user, nil) 应用
程序的控制器:
#CanCan
def current_ability
@current_ability ||= Ability.new(current_user, nil) # since no group
end
路线:
resources :invitations
有什么想法 CanCan 不高兴吗?谢谢
Error:
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'
In CanCan i have:
can :manage, Invitation
in the Invitations Controller:
before_filter :current_ability # CanCan
load_and_authorize_resource #CanCan
def current_ability
@current_ability ||= Ability.new(current_user, nil)
end
Application's controller:
#CanCan
def current_ability
@current_ability ||= Ability.new(current_user, nil) # since no group
end
Routes:
resources :invitations
Any thoughts why CanCan isn't happy? thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在尝试引用未定义的类。
app/models/invitation.rb
中是否有一个文件定义此Invitation
类?Looks like you are trying to reference a class that is not defined. Is there a file at
app/models/invitation.rb
that defines thisInvitation
class?