Module: Switchman::ActiveRecord::FinderMethods
- Defined in:
- lib/switchman/active_record/finder_methods.rb
Instance Method Summary collapse
-
#find_one(id) ⇒ Object
find_one uses binds, so we can’t depend on QueryMethods catching it.
Instance Method Details
#find_one(id) ⇒ Object
find_one uses binds, so we can’t depend on QueryMethods catching it
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/switchman/active_record/finder_methods.rb', line 6 def find_one(id) local_id, shard = Shard.local_id_for(id) return super(local_id) if shard_source_value != :implicit if shard begin old_shard_value = shard_value self.shard_value = shard super(local_id) ensure self.shard_value = old_shard_value end else super end end |