Module SeamlessDatabasePool::ControllerFilter
In: lib/seamless_database_pool/controller_filter.rb

This module provides a simple method of declaring which read pool connection type should be used for various ActionController actions. To use it, you must first mix it into you controller and then call use_database_pool to configure the connection types. Generally you should just do this in ApplicationController and call use_database_pool in your controllers when you need different connection types.

Example:

  ApplicationController < ActionController::Base
    include SeamlessDatabasePool::ControllerFilter
    use_database_pool :all => :persistent, [:save, :delete] => :master
    ...

Methods

Classes and Modules

Module SeamlessDatabasePool::ControllerFilter::ClassMethods

Public Class methods

Public Instance methods

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

Force the master connection to be used on the next request. This is very useful for the Post-Redirect pattern where you post a request to your save action and then redirect the user back to the edit action. By calling this method, you won‘t have to worry if the replication engine is slower than the redirect. Normally you won‘t need to call this method yourself as it is automatically called when you perform a redirect from within a master connection block. It is made available just in case you have special needs that don‘t quite fit into this module‘s default logic.

[Validate]