views:

18

answers:

2

How do I access the contents of database.yml inside an ActiveRecord migration? Specifically, I need the value of the database key for the database being migrated.

+1  A: 
db = YAML.load_file("#{RAILS_ROOT}/config/database.yml")[RAILS_ENV]['database']
Ashwin Phatak
That did it. ThankYou();
landon9720
A: 

Try ActiveRecord::Base.configurations

Hemant Kumar