From 67e0dd3417ee751ccbe1443b0c62e074e6ae2976 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Tue, 25 Jan 2022 11:14:54 +0100 Subject: [PATCH] Remove Struct inheritance from headless policy example --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d42dcc6c..0545c1b9 100644 --- a/README.md +++ b/README.md @@ -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 ```