Rails 3.1, Sprockets and Amazon S3?

47 views
Skip to first unread message

Martin Wawrusch

unread,
Jun 6, 2011, 4:24:24 PM6/6/11
to rubyonra...@googlegroups.com
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



Colin Ross

unread,
Jun 14, 2011, 5:50:03 PM6/14/11
to rubyonra...@googlegroups.com
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?

Martin Wawrusch

unread,
Jun 14, 2011, 6:21:18 PM6/14/11
to rubyonra...@googlegroups.com
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.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/jkX6fApkAJIJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




Reply all
Reply to author
Forward
0 new messages