Asset-caching

Having solved my previous asset_hosts problem, I’m now moving on to
bigger and more entertaining issues, this one involving
javascript_include_tag’s new :cache parameter.

Code snippet thus:

<%= javascript_include_tag “prototype”, “scriptaculous”,
“effects”, :cache => “base” %>

Run it on production and guess what error I get:

A ActionView::TemplateError occurred in users#show:
Permission denied - /var/www/apps/moomai/releases/20071219025219/
public/javascripts/base.js
On line #8 of users/show.rhtml

The Rails user doesn’t have access to the caches it generates? Nice.
Any ideas?

Are you sure the file exists and if not, it can be created?

Sounds more like the process running your app (‘mongrel’? ‘nobody’?)
doesn’t have permission to WRITE (create) the file to begin with.

Just a thought.

Yeah you’re right … the files don’t exist at all, so Rails clearly
couldnt write to that directory. Not sure exactly what I’m supposed to
do in this instance though. The particular user is mongrel_moomai, and
the /releases folder has drwxrwxr-x permissions for deploy:deploy, of
which mongrel_moomai is a member.

I tried doing a chmod ug+rw public/javascripts && chmod ug+rw public/ stylesheets but that didn’t really work.
The main issue is that I don’t know what’s writing the file and how to
give it write access to those particular folders.

:luis