Module: SeamlessDatabasePool::ControllerFilterHooks

Defined in:
lib/seamless_database_pool/controller_filter.rb

Instance Method Summary collapse

Instance Method Details

#perform_action(*args) ⇒ Object

Rails 2.x hook for setting the read connection for the request.



99
100
101
102
103
# File 'lib/seamless_database_pool/controller_filter.rb', line 99

def perform_action(*args)
  set_read_only_connection_for_block(action_name) do
    super
  end
end

#process(action, *args) ⇒ Object

Rails 3.x hook for setting the read connection for the request.



92
93
94
95
96
# File 'lib/seamless_database_pool/controller_filter.rb', line 92

def process(action, *args)
  set_read_only_connection_for_block(action) do
    super(action, *args)
  end
end

#redirect_to(options = {}, response_status = {}) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/seamless_database_pool/controller_filter.rb', line 105

def redirect_to(options = {}, response_status = {})
  if SeamlessDatabasePool.read_only_connection_type(nil) == :master
    use_master_db_connection_on_next_request
  end

  super(options, response_status)
end