Exception: ActiveRecord::InverseOfAssociationNotFoundError

Inherits:
ActiveRecordError
  • Object
show all
Defined in:
lib/active_record/associations.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Correction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reflection = nil, associated_class = nil) ⇒ InverseOfAssociationNotFoundError

Returns a new instance of InverseOfAssociationNotFoundError.



45
46
47
48
49
50
51
52
53
# File 'lib/active_record/associations.rb', line 45

def initialize(reflection = nil, associated_class = nil)
  if reflection
    @reflection = reflection
    @associated_class = associated_class.nil? ? reflection.klass : associated_class
    super("Could not find the inverse association for #{reflection.name} (#{reflection.options[:inverse_of].inspect} in #{associated_class.nil? ? reflection.class_name : associated_class.name})")
  else
    super("Could not find the inverse association.")
  end
end

Instance Attribute Details

#associated_classObject (readonly)

Returns the value of attribute associated_class.



44
45
46
# File 'lib/active_record/associations.rb', line 44

def associated_class
  @associated_class
end

#reflectionObject (readonly)

Returns the value of attribute reflection.



44
45
46
# File 'lib/active_record/associations.rb', line 44

def reflection
  @reflection
end