Skip to content

Instantly share code, notes, and snippets.

@foca
Created April 29, 2012 21:22
Show Gist options
  • Save foca/2553330 to your computer and use it in GitHub Desktop.
Save foca/2553330 to your computer and use it in GitHub Desktop.
Completely confounded by Rails 3.2.3, the asset pipeline, and a custom asset host :-(
# config/environments/production.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server
config.action_controller.asset_host = "//#{ENV.fetch("FOG_DIRECTORY")}.s3.amazonaws.com"
# app/views/layouts/application.erb
<%= javascript_include_tag :application %>
# Resulting HTML (in heroku, with RAILS_ENV=production):
<script src="/assets/application-7ab84bc8e150bcc5d29d61ca6dce119e.js" type="text/javascript"></script>
# WTF, Rails, WTF?! (aka: what am I missing?!) Why isn't the asset served from "//blah.s3.amazonaws.com"?!?!?!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment