Skip to content

Commit

Permalink
Remove Struct inheritance from headless policy example
Browse files Browse the repository at this point in the history
  • Loading branch information
drewmoore committed Jan 25, 2022
1 parent 3c725c7 commit 67e0dd3
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 @@ -194,8 +194,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 67e0dd3

Please sign in to comment.