Exception: Authz::Scopables::Base::MisconfiguredAssociation
- Inherits:
-
StandardError
- Object
- StandardError
- Authz::Scopables::Base::MisconfiguredAssociation
- Defined in:
- lib/authz/scopables/base.rb
Overview
Error that will be raised if the association of a model being scoped does not return the expected type of objects
Instance Attribute Summary collapse
- #association_method ⇒ Object readonly
- #scopable ⇒ Object readonly
- #scoped_class ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MisconfiguredAssociation
constructor
A new instance of MisconfiguredAssociation.
Constructor Details
#initialize(options = {}) ⇒ MisconfiguredAssociation
Returns a new instance of MisconfiguredAssociation.
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/authz/scopables/base.rb', line 111 def initialize( = {}) @scoped_class = .fetch(:scoped_class) @scopable = .fetch :scopable @association_method = .fetch :association_method = "#{scoped_class} has a misconfigured association " \ "for #{scopable}. " \ "Make sure that ##{association_method} " \ 'returns either an instance of class' \ "#{scopable.scoping_class_name} " \ 'or a collection that responds to #pluck(:id).' super() end |
Instance Attribute Details
#association_method ⇒ Object (readonly)
109 110 111 |
# File 'lib/authz/scopables/base.rb', line 109 def association_method @association_method end |
#scopable ⇒ Object (readonly)
109 110 111 |
# File 'lib/authz/scopables/base.rb', line 109 def scopable @scopable end |
#scoped_class ⇒ Object (readonly)
109 110 111 |
# File 'lib/authz/scopables/base.rb', line 109 def scoped_class @scoped_class end |