Method: Sequel::Model::ClassMethods#create

Defined in:
lib/sequel/model/base.rb

#create(values = {}, &block) ⇒ Object

Creates new instance with values set to passed-in Hash, saves it (running any callbacks), and returns the instance if the object was saved correctly. If there was an error saving the object, returns false.



85
86
87
88
89
# File 'lib/sequel/model/base.rb', line 85

def create(values = {}, &block)
  obj = new(values, &block)
  return unless obj.save
  obj
end