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本身