Class: Adhearsion::ActiveRecord::Plugin::Service
- Inherits:
-
Object
- Object
- Adhearsion::ActiveRecord::Plugin::Service
- Defined in:
- lib/adhearsion/activerecord/plugin/service.rb
Class Method Summary collapse
-
.start ⇒ Object
Start the ActiveRecord connection with the configured database.
-
.stop ⇒ Object
Stop the database connection.
Class Method Details
.start ⇒ Object
Start the ActiveRecord connection with the configured database
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/adhearsion/activerecord/plugin/service.rb', line 9 def start raise "Must supply an adapter argument to the ActiveRecord configuration" if (config.adapter.nil? || config.adapter.empty?) params = config.__values.select { |k,v| !v.nil? } require_models(*params.delete(:model_paths)) establish_connection params ::ActiveRecord::Base.logger = logger create_call_hook_for_connection_cleanup end |
.stop ⇒ Object
Stop the database connection
24 25 26 |
# File 'lib/adhearsion/activerecord/plugin/service.rb', line 24 def stop ::ActiveRecord::Base.remove_connection end |