method
create!
v4.2.9 -
Show latest stable
- Class:
ActiveRecord::Persistence::ClassMethods
create!(attributes = nil, &block)public
Creates an object (or multiple objects) and saves it to the database, if validations pass. Raises a RecordInvalid error if validations fail, unlike Base#create.
The attributes parameter can be either a Hash or an Array of Hashes. These describe which attributes to be created on the object, or multiple objects when given an Array of Hashes.