How do I attach an inline image to a rails 4.2 mailer using paperclip? -
i'm using rails 4.2 , use paperclip handle image uploads. trying attach image model email. per rails guides have mailer so
def sub_conversion_email(user, blend) @user = user @blend = blend attachments.inline[@blend.image.original_filename] = file.read(@blend.image.url(:medium)) mail(to: @user.email, subject: "a subject...") end then in mailer view have
<%= image_tag attachments[@blend.image.original_filename].url %> for reason i'm getting error no such file or directory @ rb_sysopen - /system/blends/images/000/000/015/medium/filename.jpg
what doing wrong? thanks.
so taryn east pointing out needed use path instead of url in file.read(), working. thing in mailer preview, won't show image. when inspect image, src cid:........................mycomputer.mail. when send email, works fine. know how show in mailer preview?
Comments
Post a Comment