_create_record(attribute_names = self.attribute_names)
private
Creates a record with values matching those of the instance attributes and
returns its id.
# File activerecord/lib/active_record/persistence.rb, line 1247
def _create_record(attribute_names = self.attribute_names)
attribute_names = attributes_for_create(attribute_names)
returning_columns = self.class._returning_columns_for_insert
returning_values = self.class._insert_record(
attributes_with_values(attribute_names),
returning_columns
)
returning_columns.zip(returning_values).each do |column, value|
_write_attribute(column, value) if !_read_attribute(column)
end if returning_values
@new_record = false
@previously_new_record = true
yield(self) if block_given?
id
end