Module: ActiveRecord
- Defined in:
- lib/rmtools/active_record/base.rb,
lib/rmtools/active_record/declarative.rb
Defined Under Namespace
Modules: ConnectionAdapters Classes: Base, Relation
Class Method Summary collapse
- .establish_connection_with(config = 'config/database.yml') ⇒ Object (also: establish_connection)
Class Method Details
.establish_connection_with(config = 'config/database.yml') ⇒ Object Also known as: establish_connection
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rmtools/active_record/base.rb', line 6 def establish_connection_with config='config/database.yml' c = case config when String c = if config.inline if c = RMTools.read(config) then c else return; nil end else config end YAML.load c when IO then YAML.load config else config end if defined? Rails env = Rails.env.to_s if c.include? env c = c[env] end end Base.establish_connection(c) rescue(false) end |