Created
February 17, 2017 11:20
-
-
Save pedrosmmoreira/fbb2b9086cfae824ca0293fef8ef9bd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AdminFooPolicy < ApplicationPolicy | |
class Scope | |
attr_reader :user, :scope | |
def initialize(user, context) | |
@user = user | |
@scope = context.record | |
end | |
def resolve | |
scope.not_cancelled? | |
end | |
end | |
def initialize(user, context) | |
@user = user | |
@record = context.record | |
end | |
def show? | |
!record.cancelled? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment