Method: SimpleRecord::ActiveSdb::Base.create

Defined in:
lib/simple_record/active_sdb.rb

.create(attributes = {}) ⇒ Object

Create and save new Item instance. Attributes is a hash: { attribute1 => values1, …, attributeN => valuesN }.

item = Client.create('name' => 'Cat', 'toys' => ['Jons socks', 'mice', 'clew'])
puts item.inspect   #=> #<Client:0xb77a0a78 @new_record=false, @attributes={"name"=>["Cat"], "id"=>"2937601a-e45d-11dc-a75f-001bfc466dd7", "toys"=>["Jons socks", "mice", "clew"]}>


674
675
676
677
678
# File 'lib/simple_record/active_sdb.rb', line 674

def self.create(attributes={})
    item = self.new(attributes)
    item.save
    item
end