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
Looks like you are trying to reference a class that is not defined. Is there a file at app/models/invitation.rb
that defines this Invitation
class?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.