module HerokuExternalDb

Public Class Methods

setup_configuration!(env_prefix, configuration_name) click to toggle source

Construct a new HerokuExternalDb instance based on the given env_prefix and configuration_name, then install the configuration in ActiveRecord. Returns the new instance.

# File lib/heroku_external_db.rb, line 5
def self.setup_configuration!(env_prefix, configuration_name)
  HerokuExternalDb::Configuration.new(env_prefix, configuration_name).setup!
end
setup_rails_env!(env_prefix='EXTERNAL') click to toggle source

Construct a HerokuExternalDb instance for the current Rails environment, then install the configuration in ActiveRecord. You can optionally override the environment variable prefix, which is EXTERNAL by default. Returns the new instance.

Note that doing this causes DATABASE_URL to be effectively ignored.

# File lib/heroku_external_db.rb, line 15
def self.setup_rails_env!(env_prefix='EXTERNAL')
  raise "ENV['RAILS_ENV'] is not set" unless ENV['RAILS_ENV']
  setup_configuration!(env_prefix, ENV['RAILS_ENV'])
end