ryanb / cancan

Authorization Gem for Ruby on Rails.
MIT License
6.27k stars 783 forks source link

OR associations #832

Open abacha opened 11 years ago

abacha commented 11 years ago

now I have:

can :read, Person, officer_id: user.id
can :read, Person, co_officer_id: user.id

is it possible to do it on one line? like

can :read, Person, [{officer_id: user.id}, {co_officer_id: user.id}]

or something like that?

barkerja commented 11 years ago
can :read, Person do |p|
    p.officer_id == user.id || p.co_officer_id == user.id
end

Wouldn't that work?

abacha commented 11 years ago

it doesn't work with accessible_by

xhoy commented 10 years ago

Dear submitter, Since cancan/raynB hasn't been active for more than 6 months and no body else then ryam himself has commit permissions the cancan project is on a stand still. Since cancan has several issues including missing support for rails 4 cancan is moving forward to cancancan. More details on: #994

If your feel that your pull request or bug is still applicable (and hasn't been merged in to cancan) it would be really appreciated if you would resubmit it to cancancan (https://github.com/cancancommunity/cancancan)

We hope to see you on the other side!