New Rails 3 app, routes.rb is good, database.yml is good. Still get 500 error.

I have found there are A LOT of things that can go wrong with a Rails deployment, even if your ‘Developer Friendly RoR Host’ offers ‘Fast Rails Deployment’ and ‘Incredible Ruby Hosting’ and you are merely trying to deploy a simple ‘Hello World’ app.

As a result the internet is full of different suggestions for tweaks to make in various configuration files all throughout your Rails application directory tree. There are far too many of them to list here. I am going to provide the solution that worked for me because it was not nearly as common as the other suggested solutions so I think it needs little more representation.

If your database.yml is configured correctly (this is YAML, even bad white space can be a culprit here), and your routes.rb is configured correctly (if you are using rails generate commands this shouldn’t be an issue), and your are not trying to run your app from a sub directory (there can be quite a few tricky configuration hiccups associated with this), and you are running Rails v >= 3 (so much of the advice and tutorials floating around out there are for older versions, be careful!); like me. Then you might want to check /log/production.log and see if there’s an error like this: Template::Error (application.css isn't precompiled):. If there is then you need to run the following command in the command line from your applications root:

rake assets:precompile

you can open up /config/environments/production.rb and set config.assets.compile to true. This method is not recommended for use in production environments.

About C. Scott Asbach

Scott is a freelance web designer/developer and stay-at-home dad. He holds an AA degree in Electronic Imaging and Media Arts and is going back to school to earn a BA in Computer Information Systems.
This entry was posted in Tutorials and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>