This is executed in the context of capistrano.  Are you sure you have access to `Rails` like you've done?  I feel like this shouldn't work....