私の能力クラスにこんな感じのものがあります
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
上記のブロックはクラス自体ではなく store のインスタンスでのみ実行されるべきだと思ったので、ここで true を返す理由がわかりません
staff = Staff.first
staff.can? :manage, Store #true
staff.can? :manage, Store.first #false, because there is no staff_privileges associated to this store