Class: Standby::ConnectionHolder
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Standby::ConnectionHolder
- Defined in:
- lib/standby/connection_holder.rb
Class Method Summary collapse
-
.activate(target) ⇒ Object
for delayed activation.
Methods inherited from ActiveRecord::Base
connection, connection_without_standby, on_standby
Class Method Details
.activate(target) ⇒ Object
for delayed activation
7 8 9 10 11 |
# File 'lib/standby/connection_holder.rb', line 7 def activate(target) spec = ActiveRecord::Base.configurations["#{ActiveRecord::ConnectionHandling::RAILS_ENV.call}_#{target}"] raise Error.new("Standby target '#{target}' is invalid!") if spec.nil? establish_connection spec end |