Skip to content

Commit

Permalink
Merge pull request #717 from drewmoore/update-documentation-for-headl…
Browse files Browse the repository at this point in the history
…ess-policies

Remove Struct inheritance from headless policy example
  • Loading branch information
Burgestrand authored Feb 11, 2022
2 parents 856d74d + 67e0dd3 commit 54675c6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,17 @@ you can retrieve it by passing a symbol.

```ruby
# app/policies/dashboard_policy.rb
class DashboardPolicy < Struct.new(:user, :dashboard)
# ...
class DashboardPolicy
attr_reader :user

# _record in this example will just be :dashboard
def initialize(user, _record)
@user = user
end

def show?
user.admin?
end
end
```

Expand Down

0 comments on commit 54675c6

Please sign in to comment.