I'm using pgcrypto
gem to encrypt data in certain columns of the database, but in order for this gem to work I have to specify pgcrypto
as an adapter in database.yml
file. I know that Heroku disregards this file and generates its own when application is pushed to Heroku server, which uses default postgresql
adapter. Does anybody know if it's possible to override adapter
value, with a configuration variable for example?
specify database adapter on Heroku
203 views Asked by koss At
2
There are 2 answers
1
On
You can manually create a database connection with
`ActiveRecord::Base.establish_connection(config)
you could also do this on a per-model basis using a mixing.
More info is here Understanding how establish_connection works in ActiveRecord
Eventually found the solution, which happened to be a quite simple one - I just had to replace the first token in the Heroku's database URL variable, so instead of
postgres://username:password@host:port/dbname
I use
pgcrypto://username:password@host:port/dbname