This is a sample code taken directly (but slightly modified) from the documentation of asset_host
ActionController::Base.asset_host = Proc.new { |source|
if source.ends_with?('.css')
"http://myapp.herokuapp.com"
else
"http://assets.example.com"
end
}
image_tag("rails.png")
# => <img alt="Rails" src="http://assets.example.com/assets/rails.png" />
stylesheet_link_tag("application")
# => <link href="http://myapp.herokuapp.com/assets/application.css" media="screen" rel="stylesheet" />