Module: Switchman::ActiveRecord::Persistence
- Defined in:
- lib/switchman/active_record/persistence.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #reload ⇒ Object
-
#touch ⇒ Object
touch reads the id attribute directly, so it’s not relative to the current shard.
- #update_columns ⇒ Object
Instance Method Details
#delete ⇒ Object
15 16 17 18 |
# File 'lib/switchman/active_record/persistence.rb', line 15 def delete db = shard.database_server db.unguard { super } end |
#reload ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/switchman/active_record/persistence.rb', line 20 def reload(*) res = super # When a shadow record is reloaded the real record is returned. So # we need to ensure the loaded_from_shard is set correctly after a reload. @loaded_from_shard = @shard res end |
#touch ⇒ Object
touch reads the id attribute directly, so it’s not relative to the current shard
7 8 9 |
# File 'lib/switchman/active_record/persistence.rb', line 7 def touch(*, **) shard.activate(self.class.connection_class_for_self) { super } end |
#update_columns ⇒ Object
11 12 13 |
# File 'lib/switchman/active_record/persistence.rb', line 11 def update_columns(*) shard.activate(self.class.connection_class_for_self) { super } end |