Module: Defile::Controller

Defined in:
lib/defile/rails.rb

Instance Method Summary collapse

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
# File 'lib/defile/rails.rb', line 5

def show
  file = Defile.backends.fetch(params[:backend_name]).get(params[:id])

  options = { disposition: "inline" }
  options[:type] = Mime::Type.lookup_by_extension(params[:format]).to_s if params[:format]

  send_data file.read, options
end