cancancan: "can :create, Model do" broken?

Given the following ability:

can :create, Page do
  user.has_role?(:manager)
end

The following has worked in the past:

u = User.first
u.has_role?(:manager)     # => false
a = Ability.new u
a.can? :create, Page   # => false

However, I just figured out that this no longer holds. The block passed to can in the definition is not hit unless you pass an instance, so this is what it looks like now:

a.can? :create, Page       # => true - OOPS!
a.can? :create, Page.new   # => false - OK

Is this a bug or a feature?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@Senjai Why are you closing this when there is no fix in the develop branch?