I have been writing some rails apps recently. Here are some of the things I have encountered.

Phusion passenger: http://www.modrails.com/

It runs your app as the user who owns environment.rb. If environment.rb is owned by root, then it defaults to the PassengerDefaultUser in the httpd.conf file. This is nobody by default. If you have any system("","") commands, make sure to set your user appropriately.

Ruby system startup script:
Here is one from my brother-in-law, the famous Tim Morgan http://snippets.dzone.com/posts/show/2594

Here is one I made for my use with delayed_job, http://github.com/jrichter/delayed_job/tree/master/lib/delayed/worker_startup_script

In a ruby startup script the shebang line should be #!/usr/bin/env ruby

To load a rails environment and get rake support make sure to include:

app_dir = '/path/to/rails/app'
require(File.join(app_dir, 'config', 'boot'))

Then if you need to run a rake task, such as db:migrate:

system "/usr/bin/ruby /usr/bin/rake -f #{app_dir}/Rakefile db:migrate &"