mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Merge pull request #199 from johnotander/add-pundit-prefix-to-instance-variables
Add 'pundit' prefix to instance variables to avoid collisions.
This commit is contained in:
commit
56972f2b50
1 changed files with 6 additions and 6 deletions
|
@ -55,16 +55,16 @@ module Pundit
|
|||
end
|
||||
|
||||
def verify_authorized
|
||||
raise AuthorizationNotPerformedError unless @_policy_authorized
|
||||
raise AuthorizationNotPerformedError unless @_pundit_policy_authorized
|
||||
end
|
||||
|
||||
def verify_policy_scoped
|
||||
raise PolicyScopingNotPerformedError unless @_policy_scoped
|
||||
raise PolicyScopingNotPerformedError unless @_pundit_policy_scoped
|
||||
end
|
||||
|
||||
def authorize(record, query=nil)
|
||||
query ||= params[:action].to_s + "?"
|
||||
@_policy_authorized = true
|
||||
@_pundit_policy_authorized = true
|
||||
|
||||
policy = policy(record)
|
||||
unless policy.public_send(query)
|
||||
|
@ -78,7 +78,7 @@ module Pundit
|
|||
end
|
||||
|
||||
def policy_scope(scope)
|
||||
@_policy_scoped = true
|
||||
@_pundit_policy_scoped = true
|
||||
policy_scopes[scope] ||= Pundit.policy_scope!(pundit_user, scope)
|
||||
end
|
||||
|
||||
|
@ -87,11 +87,11 @@ module Pundit
|
|||
end
|
||||
|
||||
def policies
|
||||
@_policies ||= {}
|
||||
@_pundit_policies ||= {}
|
||||
end
|
||||
|
||||
def policy_scopes
|
||||
@_policy_scopes ||= {}
|
||||
@_pundit_policy_scopes ||= {}
|
||||
end
|
||||
|
||||
def pundit_user
|
||||
|
|
Loading…
Add table
Reference in a new issue