Module: Dynamoid::Persistence
Overview
This module saves things!
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#delete ⇒ Object
28 29 30 31 |
# File 'lib/dynamoid/persistence.rb', line 28 def delete delete_indexes Dynamoid::Adapter.delete_item(self.class.table_name, self.id) end |
#destroy ⇒ Object
22 23 24 25 26 |
# File 'lib/dynamoid/persistence.rb', line 22 def destroy run_callbacks(:destroy) do self.delete end end |
#save ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/dynamoid/persistence.rb', line 14 def save run_callbacks(:save) do self.id = SecureRandom.uuid if self.id.nil? || self.id.blank? Dynamoid::Adapter.put_item(self.class.table_name, self.attributes) save_indexes end end |