Module: FreshConnection

Extended by:
ActiveSupport::Autoload
Defined in:
lib/fresh_connection.rb,
lib/fresh_connection/railtie.rb,
lib/fresh_connection/version.rb,
lib/fresh_connection/initializer.rb,
lib/fresh_connection/access_control.rb,
lib/fresh_connection/extend/ar_base.rb,
lib/fresh_connection/slave_connection.rb,
lib/fresh_connection/connection_manager.rb,
lib/fresh_connection/extend/ar_relation.rb,
lib/fresh_connection/extend/mysql2_adapter.rb,
lib/fresh_connection/slave_connection_handler.rb,
lib/fresh_connection/extend/connection_handler.rb,
lib/fresh_connection/rack/connection_management.rb,
lib/fresh_connection/abstract_connection_manager.rb

Defined Under Namespace

Modules: Extend, Rack Classes: AbstractConnectionManager, AccessControl, ConnectionManager, Initializer, Railtie, SlaveConnection, SlaveConnectionHandler

Constant Summary collapse

VERSION =
"0.2.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connection_managerObject



17
18
19
20
# File 'lib/fresh_connection.rb', line 17

def connection_manager
  manager_klass = @connection_manager || rails_config(:connection_manager) || ConnectionManager
  manager_klass.is_a?(String) ? manager_klass.constantize : manager_klass
end

.envObject



30
31
32
# File 'lib/fresh_connection.rb', line 30

def env
  @env || defined?(Rails) && Rails.env
end

.ignore_configure_connection=(value) ⇒ Object (writeonly)

Sets the attribute ignore_configure_connection

Parameters:

  • value

    the value to set the attribute ignore_configure_connection to.



15
16
17
# File 'lib/fresh_connection.rb', line 15

def ignore_configure_connection=(value)
  @ignore_configure_connection = value
end

.retry_limitObject



26
27
28
# File 'lib/fresh_connection.rb', line 26

def retry_limit
  @retry_limit || rails_config(:retry_limit) || 3
end

Class Method Details

.ignore_configure_connection?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fresh_connection.rb', line 22

def ignore_configure_connection?
  !!(@ignore_configure_connection || rails_config(:ignore_configure_connection))
end

.rails_3?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fresh_connection.rb', line 34

def rails_3?
  ActiveRecord::VERSION::MAJOR == 3
end

.rails_4?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fresh_connection.rb', line 38

def rails_4?
  ActiveRecord::VERSION::MAJOR == 4
end