Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object and Subobject #44

Closed
sadjehwty opened this issue Feb 12, 2018 · 1 comment
Closed

Object and Subobject #44

sadjehwty opened this issue Feb 12, 2018 · 1 comment

Comments

@sadjehwty
Copy link

How can I define rule for a subobject extends object rule.
es.

can :delete, Object do |obj, user|
  post.author_id == user.id
end
can :delete, Subobject do |sub, user|
  can? :delete, sub.parent && sub.id>3
end
@pokonski
Copy link
Contributor

Hi! If I understood you correctly, then: there is no inheritance between can blocks and Access Granted has no special handling for inheritance of Ruby classes.

You can DRY it up by extracting common logic into methods and use that in blocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants