carrierwave-mongoid-media/app/controllers/media_controller.rb
2012-10-10 20:45:35 -04:00

13 lines
309 B
Ruby

class MediaController < ApplicationController
def show
path = params[:path] + '.' + params[:format]
obj = Mongoid::GridFS[path]
raise Mongoid::Errors::DocumentNotFound.new(Mongoid::GridFS, :path => path) if !obj
self.content_type = obj.content_type
self.response_body = obj
end
end