Permission Denied Saving Attachment
The Symptoms
When using image science or other libraries which make use of inline Ruby, you may get an error like this:
Permission denied - /.ruby_inline
you might also notice errors such as:
Expected /var/www/apps/myapp/current/config/../app/models/attachment.rb to define Attachment
The Solution
The problem is that your mongrels are trying to write to a directory they do not have write permissions to. Since your mongrel_cluster runs as deploy, the fix is to make sure ruby_inline will write to a directory that your deploy user does have permission on.
Create the file config/initializers/ruby_inline.rb with the line:
ENV['HOME'] = "/home/deploy" if ENV['RAILS_ENV'] == 'production'
Add the file to svn, commit, and redeploy.
