Really simple way of handling media in a Carrierwave/Mongoid/GridFS setup
Go to file
2013-03-11 16:21:59 -04:00
app clean up and rework a ton of stuff 2013-03-11 16:21:59 -04:00
lib clean up and rework a ton of stuff 2013-03-11 16:21:59 -04:00
.gitignore initial commit 2012-10-10 20:45:35 -04:00
carrierwave-mongoid-media.gemspec clean up and rework a ton of stuff 2013-03-11 16:21:59 -04:00
Gemfile initial commit 2012-10-10 20:45:35 -04:00
LICENSE.txt initial commit 2012-10-10 20:45:35 -04:00
Rakefile initial commit 2012-10-10 20:45:35 -04:00
README.md clean up and rework a ton of stuff 2013-03-11 16:21:59 -04:00

Make it very easy to accept Carrierwave uploads to a Mongoid GridFS-backed data store and then deliver them.

Add this to your config/routes.rb:

My::Application.routes.draw do
  CarrierWave::Mongoid::Media.routes(self)
end

And you'll have a /media/:id route that just delivers whatever Carrierwave uploads to this app, as long as you're using carrierwave-mongoid to do the uploads. CarrierWave's grid_fs_access_url will be set correctly for you, too.

You can specify if any of the paths should respond with Content-Disposition: attachment headers with an initializer:

# config/initializers/carrierwave_mongoid_media.rb

CarrierwaveMongoidMedium.force_downloads_on do |path|
  # return true if the file should get Content-Disposition: attachment
end