Module: NanoStore::ModelInstanceMethods
- Included in:
- Model
- Defined in:
- lib/nano_store/model.rb
Instance Method Summary collapse
Instance Method Details
#delete ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/nano_store/model.rb', line 12 def delete raise NanoStoreError, 'No store provided' unless self.class.store error_ptr = Pointer.new(:id) self.store.removeObject(self, error: error_ptr) raise NanoStoreError, error_ptr[0].description if error_ptr[0] self end |
#save ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/nano_store/model.rb', line 3 def save raise NanoStoreError, 'No store provided' unless self.class.store error_ptr = Pointer.new(:id) self.store.addObject(self, error:error_ptr) raise NanoStoreError, error_ptr[0].description if error_ptr[0] self end |
#store ⇒ Object
21 22 23 |
# File 'lib/nano_store/model.rb', line 21 def store super || self.class.store end |