Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. mms.process do |media_type, files|
  2. # go through each file
  3. files.each do |filename|
  4. # if it's a format we support, create a record
  5. if media_type =~ /pdf/ # just pdfs for now, to reduce confusion
  6. File.open(filename) do |tempfile|
  7. # Somewhere in here I'd like to change filename.content_type
  8. # to the proper type using mimetype-fu
  9. # except doing tempfile.content_type = whatever doesn't seem to work.
  10.  
  11. thing = Thing.new
  12. thing.document = tempfile
  13. thing.save!
  14. end
  15. end
  16. end
  17. end
  18.  
  19. thing.document_content_type = whatever
Add Comment
Please, Sign In to add comment