I have managed to fix it by adding this to the Application class of config/application.rb
like I had tried before...
config.assets.initialize_on_precompile = false`
but this time also adding this to config/environment/production.rb
...
config.assets.compile = true
It means that I have to run this each time I have changed the assets and want to push the commit to Heroku....
rake assets:precompile
All this to prevent the Heroku precompile error, as it tries to initialise and attach to the DB before the ENV vars are available.
[source]