I'm running on Rails 3.2.2 and deploying on a Cedar stack. I still get the following error:
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
Even the guide suggests setting config.assets.initialize_on_precompile
to false, but mentions:
be sure to test rake assets:precompile locally before deploying. It may expose bugs where your assets reference application objects or methods, since those are still in scope in development mode regardless of the value of this flag.
Some articles such as this one suggest using Heroku labs. But even this, comes with its own implication, since it is still on beta.
I've read on several other sources online, including:
Rails 3.1 assets:precompile Connecting to Database
rake assets:precompile not working on heroku
All come with different solutions. So what is the proper way of avoiding this error? Anyone experience any big problems with Heroku labs? Is there a better approach?
PS. Just to be clear. Is running rake assets:precompile RAILS_ENV=development
or rake assets:precompile RAILS_ENV=production
the proper way of running this locally?