> I am trying to send data from a remote file attachment.... > ------- > attachment['url'] = "http://www.mydomain.com/resource/download/54643" > > I wrote a class RemoteFile < ::Tempfile to fetch to remote data > ------ > remote_file = RemoteFile.new(attachment['url'] ) > so, I get a tempfile >>> #<File:/var/folders/NK/NKfWCW3eEVCg0ERnpPsnME+++TI/-Tmp-/ > 93806edfbb0daf7303347d7faaffc2d0f5b22a1d20100914-5545-1y66mt8-0> > > now I would like to pass the content of this temp file as a base64 > value > ... > ticketing_xml << "<value><base64>#{ tmp_data }</base64></value>" > ... > > how should I do write the tmp_data ? > > should I use : open(remote_file ).read
Sure. If these remote files are big, your Rails processes are going to eat a lot of ram. Instead of reading things into a temp file first, look into open-uri so you can simply read it directly from the remote host into your xml string... -philip -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

