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) ⇒ Object
- #table ⇒ Object
Instance Method Details
#create(attributes = {}) {|record| ... } ⇒ Record
Initialize a new record instance, assign attributes, and immediately save it.
44 45 46 |
# File 'lib/cequel/record/persistence.rb', line 44 def create(attributes = {}, &block) new(attributes, &block).tap { |record| record.save } end |
#hydrate(row) ⇒ Object
54 55 56 |
# File 'lib/cequel/record/persistence.rb', line 54 def hydrate(row) new_empty(row).__send__(:hydrated!) end |
#table ⇒ Object
49 50 51 |
# File 'lib/cequel/record/persistence.rb', line 49 def table connection[table_name] end |