method
initialize_attributes
v5.0.0.1 -
Show latest stable
- Class:
ActiveRecord::Associations::Association
initialize_attributes(record, except_from_scope_attributes = nil)public
No documentation available.
# File activerecord/lib/active_record/associations/association.rb, line 166
def initialize_attributes(record, except_from_scope_attributes = nil) #:nodoc:
except_from_scope_attributes ||= {}
skip_assign = [reflection.foreign_key, reflection.type].compact
assigned_keys = record.changed
assigned_keys += except_from_scope_attributes.keys.map(&:to_s)
attributes = create_scope.except(*(assigned_keys - skip_assign))
record.assign_attributes(attributes)
set_inverse_instance(record)
end