Sha256: 2e1c6cde08b53eaae679884b408898c2bf181ee3aecd0f9ec9bbd462f17b6fc4
Contents?: true
Size: 911 Bytes
Versions: 3
Compression:
Stored size: 911 Bytes
Contents
# A paperclip-like UpFile class # # Paperclip checks for :original_filename and :content_type # so, let's giv'em to it # # the other attributes are :to_tempfile and :size but those are # handled by Mash's :method_missing class Fash < File # rack_multipart is what you get when # a multipart-encoded form is submitted # # converts a standard rack multipart file upload # to an object paperclip will understand def initialize(rack_multipart) @original = rack_multipart super(rack_multipart.is_a?(String) ? rack_multipath : @original[:tempfile].path) end def to_tempfile @original[:tempfile] || @original end alias :paperclip_original_filename :original_filename def original_filename @original[:filename] || paperclip_original_filename end alias :paperclip_content_type :content_type def content_type @original[:type] || paperclip_content_type end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rmce_uploadr-0.0.3 | lib/rmce_uploadr/core/fash.rb |
rmce_uploadr-0.0.2 | lib/rmce_uploadr/core/fash.rb |
rmce_uploadr-0.0.1 | lib/rmce_uploadr/core/fash.rb |