Module: HerokuExternalDb

Defined in:
lib/heroku_external_db.rb,
lib/generators/heroku_external_db/heroku_external_db_generator.rb

Defined Under Namespace

Classes: Configuration, Generator

Class Method Summary collapse

Class Method Details

.setup_configuration!(env_prefix, configuration_name) ⇒ Object

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



5
6
7
# 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') ⇒ Object

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.



15
16
17
18
# 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