I came across a very similar issue, and here’s what worked for me:
When I used the one-click Rails creation, it defaulted to Ruby 2.0.0. I used RVM commands to change this to 1.9.3. Changing it back to 2.0.0 as the default, re-running bundle install (and the whole kit and kabootle of “bundle exec rake db:migrate”, “bundle exec rake assets:precompile”), and restarting the Unicorn service (“service unicorn restart”), the 504 error was gone!
I don’t have anything really holding me back to 1.9.3, so for me, I can just update my development environment to match. I’m not sure what the solution would be otherwise.. perhaps building the RoR environment from scratch on a fresh Ubuntu droplet, vs using the one-click option?