Exception: ActiveRecord::AssociationNotFoundError
- Inherits:
-
ConfigurationError
- Object
- StandardError
- ActiveRecordError
- ConfigurationError
- ActiveRecord::AssociationNotFoundError
- Defined in:
- lib/active_record/associations.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Correction
Instance Attribute Summary collapse
-
#association_name ⇒ Object
readonly
Returns the value of attribute association_name.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record = nil, association_name = nil) ⇒ AssociationNotFoundError
constructor
A new instance of AssociationNotFoundError.
Constructor Details
#initialize(record = nil, association_name = nil) ⇒ AssociationNotFoundError
Returns a new instance of AssociationNotFoundError.
9 10 11 12 13 14 15 16 17 |
# File 'lib/active_record/associations.rb', line 9 def initialize(record = nil, association_name = nil) @record = record @association_name = association_name if record && association_name super("Association named '#{association_name}' was not found on #{record.class.name}; perhaps you misspelled it?") else super("Association was not found.") end end |
Instance Attribute Details
#association_name ⇒ Object (readonly)
Returns the value of attribute association_name.
8 9 10 |
# File 'lib/active_record/associations.rb', line 8 def association_name @association_name end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
8 9 10 |
# File 'lib/active_record/associations.rb', line 8 def record @record end |