Module: EmptyEye::Persistence
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/empty_eye/persistence.rb
Instance Method Summary collapse
-
#create ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the saving come back and cleanup.
-
#delete ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the deletion come back and cleanup.
-
#destroy ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the destruction come back and cleanup.
-
#update(attribute_names = @attributes.keys) ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the saving.
Instance Method Details
#create ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the saving come back and cleanup
16 17 18 19 20 21 22 |
# File 'lib/empty_eye/persistence.rb', line 16 def create return super unless mti_class? shard_wrangler.cascade_save ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled? @new_record = false self.id end |
#delete ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the deletion come back and cleanup
40 41 42 43 44 45 46 47 48 |
# File 'lib/empty_eye/persistence.rb', line 40 def delete return super unless mti_class? shard_wrangler.class.cascade_delete_all(:id => id) if ActiveRecord::IdentityMap.enabled? and persisted? ActiveRecord::IdentityMap.remove(self) end @destroyed = true freeze end |
#destroy ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the destruction come back and cleanup
27 28 29 30 31 32 33 34 35 |
# File 'lib/empty_eye/persistence.rb', line 27 def destroy return super unless mti_class? shard_wrangler.destroy if ActiveRecord::IdentityMap.enabled? and persisted? ActiveRecord::IdentityMap.remove(self) end @destroyed = true freeze end |
#update(attribute_names = @attributes.keys) ⇒ Object
if it is not a mti_class do what you do else let the primary shard do the saving
7 8 9 10 11 |
# File 'lib/empty_eye/persistence.rb', line 7 def update(attribute_names = @attributes.keys) return super unless mti_class? shard_wrangler.cascade_save 1 end |