Commit 6f3ce803 authored by Amy Qualls's avatar Amy Qualls

Merge branch 'kc-update-policies-doc-2' into 'master'

Fix typo on DeclarativePolicy docs

See merge request gitlab-org/gitlab!32224
parents d5c9f0b0 fd44e195
......@@ -123,7 +123,7 @@ class FooPolicy < BasePolicy
end
```
Naively, if we call `Ability.can?(user1, :some_ability, foo)` and `Ability.can?(user2, :some_ability, foo)`, we would have to calculate the condition twice - since they are for different users. But if we use the `scope: :subject` option:
Naively, if we call `Ability.allowed?(user1, :some_ability, foo)` and `Ability.allowed?(user2, :some_ability, foo)`, we would have to calculate the condition twice - since they are for different users. But if we use the `scope: :subject` option:
```ruby
condition(:expensive_condition, scope: :subject) { @subject.expensive_query? }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment