Skip to content

Instantly share code, notes, and snippets.

@juggy
Created January 6, 2011 22:05
Show Gist options
  • Save juggy/768696 to your computer and use it in GitHub Desktop.
Save juggy/768696 to your computer and use it in GitHub Desktop.
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"].include? ".pdf"
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}
@alexparker
Copy link

If you use the OP's method:

consider using this instead

if request.path.include? ".pdf"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment