Sha256: 574c2d8f53c35a70dc417f3900e5a0c4adfd3d52ceb5cd9e39189242832aacaf

Contents?: true

Size: 509 Bytes

Versions: 77

Compression:

Stored size: 509 Bytes

Contents

require 'active_record'
require 'rubypitaya/core/database_config'

module RubyPitaya

  class DatabaseConnector

    def initialize(database_config)
      @database_config = database_config
    end

    def connect
      ActiveRecord::Base.establish_connection(@database_config.connection_data)
      ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
      ActiveSupport::LogSubscriber.colorize_logging = true
    end

    def disconnect
      ActiveRecord::Base.connection.close
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
rubypitaya-3.0.1 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-3.0.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.27.1 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.27.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.26.3 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.26.2 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.26.1 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.26.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.25.1 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.25.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.24.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.23.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.22.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.21.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.20.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.19.1 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.19.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.18.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.17.0 ./lib/rubypitaya/core/database_connector.rb
rubypitaya-2.16.0 ./lib/rubypitaya/core/database_connector.rb