Module: Kangaroo::Model::Persistence::ClassMethods
- Defined in:
- lib/kangaroo/model/persistence.rb
Instance Method Summary collapse
-
#create(attributes = {}) ⇒ Object
Initialize a record and immediately save it.
-
#find(id) ⇒ Object
Retrieve a record by id.
Instance Method Details
#create(attributes = {}) ⇒ Object
Initialize a record and immediately save it
94 95 96 97 98 |
# File 'lib/kangaroo/model/persistence.rb', line 94 def create attributes = {} new(attributes).tap do |new_record| new_record.save end end |
#find(id) ⇒ Object
Retrieve a record by id
105 106 107 108 109 |
# File 'lib/kangaroo/model/persistence.rb', line 105 def find id Array === id ? find_every(ids) : find_single(id) end |