Class: SlavePools::Config
- Inherits:
-
Object
- Object
- SlavePools::Config
- Defined in:
- lib/slave_pools/config.rb
Instance Attribute Summary collapse
-
#defaults_to_master ⇒ Object
When true, all queries will go to master unless wrapped in with_pool{}.
-
#environment ⇒ Object
The current environment.
-
#safe_methods ⇒ Object
The list of methods considered safe to send to a readonly connection.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 |
# File 'lib/slave_pools/config.rb', line 16 def initialize @environment = 'development' @defaults_to_master = false @safe_methods = [] end |
Instance Attribute Details
#defaults_to_master ⇒ Object
When true, all queries will go to master unless wrapped in with_pool{}. When false, all safe queries will go to the current replica unless wrapped in with_master{}. Defaults to false.
10 11 12 |
# File 'lib/slave_pools/config.rb', line 10 def defaults_to_master @defaults_to_master end |
#environment ⇒ Object
The current environment. Normally set to Rails.env, but will default to ‘development’ outside of Rails apps.
5 6 7 |
# File 'lib/slave_pools/config.rb', line 5 def environment @environment end |
#safe_methods ⇒ Object
The list of methods considered safe to send to a readonly connection. Defaults are based on Rails version.
14 15 16 |
# File 'lib/slave_pools/config.rb', line 14 def safe_methods @safe_methods end |