create!(attributes = {}, &block)
Instance Public methods
Like create
, except that if the record is invalid, raises an
exception.
class Person has_many :pets end class Pet validates :name, presence: true end person.pets.create!(name: nil) # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
Please login to continue.