Sha256: c8288598ffaf47f61596b504aa8d50ad86b6989659c472094609833ca56b2abe
Contents?: true
Size: 553 Bytes
Versions: 4
Compression:
Stored size: 553 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) || {} config = ::ActiveRecord::Base.configurations[env.to_s] ::ActiveRecord::Base.establish_connection(config) end end end
Version data entries
4 entries across 4 versions & 1 rubygems