Simply add this to the <head></head>
section of your layouts:
<%= favicon_link_tag 'favicon.ico' %>
Place the favicon.ico image in /app/assets/images/
if you are using the asset pipeline, and in /public/images/
if you are not.
Also, there is a bug if using Ruby 2.0 with Rails 3.0.20 (and maybe also 3.0.x), that will throws an exception when trying to render favicon.ico.
The fix is to place the following code into application_controller.rb:
config.relative_url_root = ""