Module: Railsless::ActiveRecord
- Defined in:
- lib/railsless/active_record.rb,
lib/railsless/active_record/rake.rb,
lib/railsless/active_record/root.rb,
lib/railsless/active_record/config.rb,
lib/railsless/active_record/version.rb,
lib/railsless/active_record/seed_loader.rb,
lib/railsless/active_record/sinatra_extension.rb
Defined Under Namespace
Modules: Rake, SinatraExtension, SinatraExtensionHelper
Classes: Config, Root, SeedLoader
Constant Summary
collapse
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.connect!(config) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/railsless/active_record.rb', line 11
def connect!(config)
db_config = config.db_config
if db_config.is_a?(String)
::ActiveRecord::Base.establish_connection(db_config)
else
::ActiveRecord::Base.configurations = db_config
::ActiveRecord::Base.establish_connection(config.env)
end
::ActiveRecord::Base.logger = config.logger
::ActiveRecord::Base
end
|
.disconnect! ⇒ Object
23
24
25
|
# File 'lib/railsless/active_record.rb', line 23
def disconnect!
::ActiveRecord::Base.clear_active_connections!
end
|