Rails 3.1, Sprockets and Amazon S3?

Hi everyone,

I am working on my first Rails 3.1 app and would like to serve production assets from s3. In 3.0 I use jammit-s3. What’s the recommended way of doing this in 3.1, especially when thinking about asset versioning through path instead of query parameter? I vaguely remember that this was addressed in a slide or video but I can’t track it down.

Thanks

Martin

The config keys I’ve found are pertinent are:

config.assets.enabled = true

and

config.action_controller.asset_host

From what I can tell, the basic functionality is there, although it might require a (either custom or standardized) rake task or the such to accomplish the actual push to your s3 bucket.

One of the issues I’ve been facing is the when you use the sprockets-based asset pipeline, it likes to add a cache-bursting hash onto the file’s name, which isn’t included when using the rail’s asset_path view helper (even the sprocket’s version).

Would seem to me that this kind of functionality should be ‘end-user/developer’ accessible but where to put the functionality: in sprockets or on the rails side?

Hi Colin,

thanks for the reply. I found this link: http://code.dblock.org/ShowPost.aspx?Id=205 which is quite helpful, and jammit-s3 includes some code that could be copied as well.

To answer your question, I think it probably should be put into sprockets, as sprockets is handling all the name mangling and image referencing, and other tools like jammit-s3 have different strategies for versioning assets.