Sha256: 992390c72c1f8a07eb50c743a466a76fb6fdeb4a317d7d71ebffce354b8abdc3
Contents?: true
Size: 750 Bytes
Versions: 6
Compression:
Stored size: 750 Bytes
Contents
class DocumentsController < CommonDocumentsController respond_to :html,:js,:png,:jpeg,:bmp,:gif SEND_FILE_METHOD = :default def create super do |format| format.all {redirect_to request.referer || home_path} end end def download path = @document.file.path(params[:style]) head(:bad_request) and return unless File.exist?(path) send_file_options = {:filename=>@document.file_file_name} case SEND_FILE_METHOD when :apache then send_file_options[:x_sendfile] = true when :nginx then head(:x_accel_redirect => path.gsub(Rails.root, '')) end send_file(path, send_file_options) end class << self def index_object_type [:Audio,:Video,:Picture,:Document] end end end
Version data entries
6 entries across 6 versions & 1 rubygems