Monserrat Foster
2013-Oct-07 14:13 UTC
How do I tell roo to open a paperclip attachment after uploaded to later processing?
Hello, I''m new to ruby and rails... I was planning to use the spreadsheet gem to open the files but it doesn''t support xlsx. I saw this as an example on how to do the same using paperclip @workbook = Spreadsheet.open(MyFile.first.attachment.to_file) I imagine with roo would be something like # In this example the model MyFile has_attached_file :attachment @workbook = Roo::Excelx.new(MyFile.first.attachment.to_file) **Like I said I''m new to Ruby and Rails, so I don''t know what''s "first", I assume it refers to the first record (the lastest) on the MyFile corresponding Table** Is this the right way to do it? I find the use of "new" confusing, although it says loads an Excel Spreadsheet for Excel .xlsx files I think it''s creating a new one instead of loading the attachment. Thank you for your guidance in advance. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b9d3744d-9a4f-42f1-b4a0-b887bb5934c1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.