0
我有一些看起来像这样在我的能力类CanCan with block会授权给Class吗?
def initialize(staff)
staff ||= Staff.new
can :manage, Store do |store|
store.staff_privileges.select(&:owner?).map(&:staff_id).include? staff.id
end
end
我不知道为什么,因为我觉得上面的块应该只得到在商店的实例,而不是类执行staff.can? :manage
这里将返回true本身