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.
db = YAML.load_file("#{RAILS_ROOT}/config/database.yml")[RAILS_ENV]['database']
Try ActiveRecord::Base.configurations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With