method
replace_records
v5.0.0.1 -
Show latest stable
- Class:
ActiveRecord::Associations::CollectionAssociation
replace_records(new_target, original_target)private
No documentation available.
# File activerecord/lib/active_record/associations/collection_association.rb, line 561
def replace_records(new_target, original_target)
delete(target - new_target)
unless concat(new_target - target)
@target = original_target
raise RecordNotSaved, "Failed to replace #{reflection.name} because one or more of the " "new records could not be saved."
end
target
end