Sha256: 4a2cfc3a38f1a322568e736e3e4f7678c2ccacf991b6d761c83579240593a0d4
Contents?: true
Size: 567 Bytes
Versions: 35
Compression:
Stored size: 567 Bytes
Contents
# frozen_string_literal: true require 'active_record' require 'erb' module DatabaseConnection def self.connect!(env) # Ref https://github.com/puma/puma#clustered-mode ActiveSupport.on_load(:active_record) do ::ActiveRecord::Base.connection_pool.disconnect! if ::ActiveRecord::Base.connected? ::ActiveRecord::Base.configurations = YAML.safe_load(ERB.new(File.read("db/config.yml")).result, [], [], true) || {} config = ::ActiveRecord::Base.configurations[env.to_s] ::ActiveRecord::Base.establish_connection(config) end end end
Version data entries
35 entries across 35 versions & 1 rubygems