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