Opening a remote image on S3 in controller (ApplicationMailer) - No such file or directory @ rb_sysopen

后端 未结 1 1743
慢半拍i
慢半拍i 2021-01-24 07:25

I am trying to open a profile picture uploaded to S3 through Paperclip, in order to submit it as an online attachment to an email.

Though I get error :

         


        
相关标签:
1条回答
  • 2021-01-24 07:45

    Like you did, you need to first:

    require 'open-uri'
    

    and then do:

    uri = URI("http:"+profilepic.to_s)
    attachments["profilepic"] = open(uri).read
    
    0 讨论(0)
提交回复
热议问题