Exception: ActiveRecord::HasManyThroughCantAssociateNewRecords
- Inherits:
-
ActiveRecordError
- Object
- StandardError
- ActiveRecordError
- ActiveRecord::HasManyThroughCantAssociateNewRecords
- Defined in:
- lib/active_record/associations.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(owner = nil, reflection = nil) ⇒ HasManyThroughCantAssociateNewRecords
constructor
A new instance of HasManyThroughCantAssociateNewRecords.
Constructor Details
#initialize(owner = nil, reflection = nil) ⇒ HasManyThroughCantAssociateNewRecords
Returns a new instance of HasManyThroughCantAssociateNewRecords.
142 143 144 145 146 147 148 |
# File 'lib/active_record/associations.rb', line 142 def initialize(owner = nil, reflection = nil) if owner && reflection super("Cannot associate new records through '#{owner.class.name}##{reflection.name}' on '#{reflection.source_reflection.class_name rescue nil}##{reflection.source_reflection.name rescue nil}'. Both records must have an id in order to create the has_many :through record associating them.") else super("Cannot associate new records.") end end |