rake assets:precompile doesn't work with PostgreSql rake assets:precompile doesn't work with PostgreSql postgresql postgresql

rake assets:precompile doesn't work with PostgreSql


Rake initializes the whole rails stack and the postgres adapter seems to test the connection on startup. Since there are no credentials for that case, rake fails.

To prevent rake from doing so, I had to put that in my config/application.rb:

config.assets.initialize_on_precompile = false

That works for me!

Found in this answer.


If you don't supply any other username by default PostgreSQL will use the operating-system username (when connections are local the the one machine). That's presumably why it's using "deploy".

Where/how you need to set the database name so it gets picked up I can't say I'm afraid.