Flowdock
method

create!

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: CollectionProxy
create!(attributes = {}, &block) public

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
Show source
Register or log in to add new notes.