Module: Cequel::Record::Persistence::ClassMethods
- Extended by:
- Forwardable
- Defined in:
- lib/cequel/record/persistence.rb
Overview
Class-level functionality for loading and saving records
Instance Method Summary collapse
-
#create(attributes = {}) {|record| ... } ⇒ Record
Initialize a new record instance, assign attributes, and immediately save it.
-
#hydrate(row) ⇒ Cequel::Record
populated with the attributes from ‘row`.
- #table ⇒ Object
Instance Method Details
#create(attributes = {}) {|record| ... } ⇒ Record
Initialize a new record instance, assign attributes, and immediately save it.
46 47 48 |
# File 'lib/cequel/record/persistence.rb', line 46 def create(attributes = {}, &block) new(attributes, &block).tap { |record| record.save } end |
#hydrate(row) ⇒ Cequel::Record
populated with the attributes from ‘row`
62 63 64 |
# File 'lib/cequel/record/persistence.rb', line 62 def hydrate(row) new_empty.hydrate(row) end |
#table ⇒ Object
51 52 53 |
# File 'lib/cequel/record/persistence.rb', line 51 def table connection[table_name] end |