Created
April 18, 2011 02:27
-
-
Save tpope/924705 to your computer and use it in GitHub Desktop.
Carrierwave on Heroku
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CarrierWave.root = Rails.root.join('tmp') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| match 'uploads/*path', to: 'uploads#show' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UploadsController < ApplicationController | |
| def show | |
| headers['Cache-Control'] = 'public; max-age=600' | |
| send_file Rails.root.join("tmp/uploads/#{params[:path]}"), :disposition => 'inline' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't forget the requirements on the route. Without it, someone could access other files in your app with a little url hacking.