Method: Sequel::Model::ClassMethods#create
- Defined in:
- lib/sequel/model/base.rb
#create(values = {}, &block) ⇒ Object
Creates instance using new with the given values and block, and saves it.
Artist.create(:name=>'Bob')
# INSERT INTO artists (name) VALUES ('Bob')
Artist.create do |a|
a.name = 'Jim'
end # INSERT INTO artists (name) VALUES ('Jim')
147 148 149 |
# File 'lib/sequel/model/base.rb', line 147 def create(values = {}, &block) new(values, &block).save end |