How do you access the raw content of a file uploaded with Paperclip / Ruby on Rails? -


i'm using paperclip / s3 file uploading. upload text-like files (not .txt, .txt). in show controller, want able contents of uploaded file, don't see contents 1 of attributes. can here?

attachment_file_name: "test.md", attachment_content_type: "application/octet-stream", attachment_file_size: 58, attachment_updated_at: "2011-06-22 01:01:40" 

ps - seems paperclip tutorials images, not text files.

here's how access raw contents of attachment:

class document    has_attached_file :revision    def revision_contents     revision.copy_to_local_file.read   end  end 

please note, i've omitted paperclip configuration options , sort of error handling.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -