method
create_record
v3.2.1 -
Show latest stable
- Class:
ActiveRecord::Associations::SingularAssociation
create_record(attributes, options, raise_error = false)private
No documentation available.
# File activerecord/lib/active_record/associations/singular_association.rb, line 54
def create_record(attributes, options, raise_error = false)
record = build_record(attributes, options)
yield(record) if block_given?
saved = record.save
set_new_record(record)
raise RecordInvalid.new(record) if !saved && raise_error
record
end