method

replace_records

rails 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 410
        def replace_records(new_target, original_target)
          delete(difference(target, new_target))

          unless concat(difference(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