Exception: Pundit::NotAuthorizedError
- Inherits:
-
Error
- Object
- StandardError
- Error
- Pundit::NotAuthorizedError
- Defined in:
- lib/pundit.rb
Overview
Error that will be raised when authorization has failed
Instance Attribute Summary collapse
- #policy ⇒ Object readonly
- #query ⇒ Object readonly
- #record ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NotAuthorizedError
constructor
A new instance of NotAuthorizedError.
Constructor Details
#initialize(options = {}) ⇒ NotAuthorizedError
Returns a new instance of NotAuthorizedError.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pundit.rb', line 28 def initialize( = {}) if .is_a? String = else @query = [:query] @record = [:record] @policy = [:policy] = .fetch(:message) { "not allowed to #{query} this #{record.class}" } end super() end |
Instance Attribute Details
#policy ⇒ Object (readonly)
26 27 28 |
# File 'lib/pundit.rb', line 26 def policy @policy end |
#query ⇒ Object (readonly)
26 27 28 |
# File 'lib/pundit.rb', line 26 def query @query end |
#record ⇒ Object (readonly)
26 27 28 |
# File 'lib/pundit.rb', line 26 def record @record end |