Class: Paperclip::Storage::Redis::App

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip/storage/redis.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/paperclip/storage/redis.rb', line 53

def call(env)
  content = ::Redis.new.get(env["PATH_INFO"].gsub(/^\//, ""))
  extname = File.extname(env["PATH_INFO"])[1..-1]
  content_type = Mime::Type.lookup_by_extension(extname)
  [200, {"Content-Type" => content_type.to_s, "Content-Length" => content.bytesize.to_s}, [content]]
rescue
  raise $!
  [404, {}, []]
end