Module: Switchman::GuardRail::ClassMethods

Included in:
Engine
Defined in:
lib/switchman/guard_rail.rb

Instance Method Summary collapse

Instance Method Details

#activate(role) ⇒ Object



11
12
13
14
# File 'lib/switchman/guard_rail.rb', line 11

def activate(role)
  DatabaseServer.send(:reference_role, role)
  super
end

#activate!(role) ⇒ Object



16
17
18
19
# File 'lib/switchman/guard_rail.rb', line 16

def activate!(role)
  DatabaseServer.send(:reference_role, role)
  super
end

#environmentObject



6
7
8
9
# File 'lib/switchman/guard_rail.rb', line 6

def environment
  # no overrides so we get the global role, not the role for the default shard
  ::ActiveRecord::Base.current_role(without_overrides: true)
end