Taylor Mitchell Taylor Mitchell - 1 year ago 84
Ruby Question

Paperclip files not being attached to actionmailer. No such file or directory

I am trying to attach a paperclip avatar image to an email, however it doesn't seem to realize it is an image that I am attaching, but when I place the url in my browser it finds the image. I am not sure if it is because of the random numbers that paperclip has at the end or not.

In my Usermailer

attachments.inline['avatar.jpg'] = File.read("localhost:3000#{@user.avatar.url(:medium)}")

In my email

<%= image_tag attachments['avatar.jpg'].url %>

The url it spits out is(The picture is a random stock photo for testing)


Answer Source

You can use the Asset pipeline to attached the actual file path. Have not tested.


You can find the answer here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download