Sha256: 83c6b9b62cf3d07faf72cd2d262ef399e0e056283f4816181ff9a92cb753184e

Contents?: true

Size: 522 Bytes

Versions: 4

Compression:

Stored size: 522 Bytes

Contents

module WhoAmI
  module Function
    class ConnectToDatabase
      include ProcParty

      def initialize(config, root)
        @config = config
        @root = root
      end

      def call
        if ActiveRecord::Base.connected?
          return
        end

        require "erb"

        config_path = config.load_environment_manual_database

        db_config = YAML.load(ERB.new(File.read(config_path)).result)

        ActiveRecord::Base.establish_connection(db_config["development"])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
who_am_i-0.0.6 lib/who_am_i/function/connect_to_database.rb
who_am_i-0.0.5 lib/who_am_i/function/connect_to_database.rb
who_am_i-0.0.4 lib/who_am_i/function/connect_to_database.rb
who_am_i-0.0.3 lib/who_am_i/function/connect_to_database.rb