Module: Tako::ActiveRecordExt::Base::InstanceMethods
- Defined in:
- lib/tako/active_record_ext/base.rb
Instance Attribute Summary collapse
-
#current_shard ⇒ Object
Returns the value of attribute current_shard.
Class Method Summary collapse
Instance Attribute Details
#current_shard ⇒ Object
Returns the value of attribute current_shard.
28 29 30 |
# File 'lib/tako/active_record_ext/base.rb', line 28 def current_shard @current_shard end |
Class Method Details
.included(mod) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/tako/active_record_ext/base.rb', line 30 def self.included(mod) mod.extend(ShardedMethods) mod.sharded_methods :update_attribute, :update_attributes, :update_attributes!, :reload, :delete, :destroy, :touch, :update_column, :save, :save! mod.class_eval do after_initialize :set_current_shard private def set_current_shard @current_shard = ::Tako::ProxyStack.top.try(:shard_name) end end end |