Sha256: 1b6ca537e45cb2b7f65bb0566297849fd3fb1a44c054c344390f589694a6db0b
Contents?: true
Size: 739 Bytes
Versions: 11
Compression:
Stored size: 739 Bytes
Contents
# Controller that serves files from the database via single action #show. # # If the file requested is an image redirect to Neofiles::ImagesController is made. # class Neofiles::FilesController < ActionController::Metal include ActionController::DataStreaming include ActionController::Redirecting include Rails.application.routes.url_helpers include Neofiles::NotFound def show file = Neofiles::File.find params[:id] if file.is_a? Neofiles::Image redirect_to neofiles_image_path(params) and return end send_file_headers!({ filename: CGI::escape(file.filename), type: file.content_type, disposition: 'inline', }) self.status = 200 self.response_body = file.data end end
Version data entries
11 entries across 11 versions & 1 rubygems