Module: XBar::Model
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/xbar/model.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #connection_proxy ⇒ Object
- #reload_connection ⇒ Object
- #reload_connection_safe ⇒ Object
- #should_set_current_shard? ⇒ Boolean
Instance Method Details
#connection_proxy ⇒ Object
27 28 29 |
# File 'lib/xbar/model.rb', line 27 def connection_proxy self.class.connection_proxy end |
#reload_connection ⇒ Object
40 41 42 43 |
# File 'lib/xbar/model.rb', line 40 def reload_connection return unless should_set_current_shard? connection_proxy.current_shard = current_shard end |
#reload_connection_safe ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/xbar/model.rb', line 31 def reload_connection_safe return yield unless should_set_current_shard? original = connection_proxy.current_shard connection_proxy.current_shard = current_shard result = yield connection_proxy.current_shard = original result end |
#should_set_current_shard? ⇒ Boolean
23 24 25 |
# File 'lib/xbar/model.rb', line 23 def should_set_current_shard? current_shard end |