Reputation: 78431
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.
Upvotes: 4
Views: 903
Reputation: 655
db = YAML.load_file("#{RAILS_ROOT}/config/database.yml")[RAILS_ENV]['database']
Upvotes: 7