Exception: Authz::Scopables::Base::NoAssociationFound

Inherits:
StandardError
  • Object
show all
Defined in:
lib/authz/scopables/base.rb

Overview

Error that will be raised if the model being scoped doesn’t appear to have an association to the scoping class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NoAssociationFound

Returns a new instance of NoAssociationFound.



95
96
97
98
99
100
101
102
# File 'lib/authz/scopables/base.rb', line 95

def initialize(options = {})
  @scoped_class  = options.fetch(:scoped_class)
  @scopable = options.fetch :scopable
  scoping_class = options.fetch :scoping_class
  message = "#{scoped_class} is not associated with " \
      "#{scoping_class} for #{scopable}. "
  super(message)
end

Instance Attribute Details

#scopableObject (readonly)



93
94
95
# File 'lib/authz/scopables/base.rb', line 93

def scopable
  @scopable
end

#scoped_classObject (readonly)



93
94
95
# File 'lib/authz/scopables/base.rb', line 93

def scoped_class
  @scoped_class
end

#scoping_classObject (readonly)



93
94
95
# File 'lib/authz/scopables/base.rb', line 93

def scoping_class
  @scoping_class
end