Exception: Checkin::AccessDenied
- Inherits:
-
StandardError
- Object
- StandardError
- Checkin::AccessDenied
- Defined in:
- lib/checkin/access_denied.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(subject, action, object_or_resource, options = {}) ⇒ AccessDenied
constructor
A new instance of AccessDenied.
- #scope ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(subject, action, object_or_resource, options = {}) ⇒ AccessDenied
Returns a new instance of AccessDenied.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/checkin/access_denied.rb', line 27 def initialize(subject, action, object_or_resource, = {}) = [:message] @subject = subject @action = action @object = ( object_or_resource.is_a?(Symbol) || object_or_resource.is_a?(String)) ? nil : object_or_resource @resource = object ? object.class.name.demodulize.underscore.to_sym : "#{object_or_resource}".singularize.to_sym = I18n.t(:"unauthorized.default", :default => "You are not authorized to access this page.") end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
25 26 27 |
# File 'lib/checkin/access_denied.rb', line 25 def action @action end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
25 26 27 |
# File 'lib/checkin/access_denied.rb', line 25 def object @object end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
25 26 27 |
# File 'lib/checkin/access_denied.rb', line 25 def resource @resource end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
25 26 27 |
# File 'lib/checkin/access_denied.rb', line 25 def subject @subject end |
Instance Method Details
#scope ⇒ Object
38 39 40 |
# File 'lib/checkin/access_denied.rb', line 38 def scope @subject.scope if @subject end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/checkin/access_denied.rb', line 42 def to_s || end |