- Rename
SwitchPoint.with_connection
toSwitchPoint.with_mode
- To avoid confusion with
ActiveRecord::ConnectionPool#with_connection
- To avoid confusion with
- Inherit superclass' switch_point configuration
- Memorize switch_point config to ConnectionSpecification#config instead of ConnectionPool
- To support multi-threaded environment since Rails 4.0.
- Add Model.transaction_with method (#2, @ryopeko)
- Establish connection lazily
- Just like ActiveRecord::Base, real connection isn't created until
.connection
is called
- Just like ActiveRecord::Base, real connection isn't created until
- Support :writable only configuration
- auto_writable is disabled by default
- To restore the previous behavior, set
config.auto_writable = true
.
- To restore the previous behavior, set
- Add shorthand methods
SwitchPoint.with_readonly
,SwitchPoint.with_writable
- Support defaulting to writable ActiveRecord::Base connection
- When
:writable
key is omitted, ActiveRecord::Base is used for the writable connection.
- When
- Improve thread safety
- Raise appropriate error if unknown mode is given to with_connection
- Support specifying the same database name within different switch_point
- Add Proxy#readonly? and Proxy#writable? predicate
- Fix nil error on with_{readonly,writable} from non-switch_point model
- Add Proxy#switch_name to switch proxy configuration
- Fix weird nil error when Config#define_switch_point isn't called yet
- Always send destructive operations to writable connection
- Fix bug on pooled connections
- Initial release