Where to store sensitive data in public rails app?

TLDR: Use environment variables! I think @Bryce’s comment offers an answer, which I’ll just flush out. It seems one approach Heroku recommends is to use environment variables to store sensitive information (API key strings, database passwords). So survey your code and see in which you have sensitive data. Then create environment variables (in your .bashrc … Read more

Ruby 1.9.2 and Rails 3 cannot open rails console

Apparently ubuntu and ruby don’t always catch dependencies like they should. From the first google hit (yeah, I clicked on this stack-overflow in place #2 before checking out the first result.) Navigate to the Ruby source and enter: sudo apt-get install libreadline5-dev cd ext/readline ruby extconf.rb make sudo make install So, if you’re on another … Read more

Heroku – Display hash of current commit in browser

It’s now possible to try the Heroku feature Roberto wrote about in his answer, without contacting Heroku. It’s called Heroku Labs: Dyno Metadata and you can enable it by heroku labs:enable runtime-dyno-metadata -a <app name> and then the information is available (on the next deploy) as environment variables: ~ $ env HEROKU_APP_ID: 9daa2797-e49b-4624-932f-ec3f9688e3da HEROKU_APP_NAME: example-app … Read more

Rails App Not Serving Assets in Production Environment

When testing locally your production environment, you have to compile the assets locally. Simply run the command below: RAILS_ENV=production bundle exec rake assets:precompile It will generate all the assets under public/assets. Next, you have to tell Rails to serve the assets itself. Server software (eg. Nginx or Apache) do it for you on environments like … Read more