paperclip + ActionMailer - Adding an attachment?

I have a paperclip'd file that I want to add as an attachment to my email....

class UserMailer < ActionMailer::Base def XXXXXX_notification(record) @record = record

  attachments ??? How to add a paperclip file?

  mail( :to => "#{record.email}", 
        :subject => "XXXXXXXX"
        )
end

There seems to be nothing on the topic via google, if you have any ideas, I'd love to hear it :)

Thanks

UPDATE

  @comment.attachments.each do |a|
    tempfile = File.new("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}", "w")
    tempfile << open(a.authenticated_url())
    tempfile.puts
    attachments[a.attachment_file_name] = File.read("#{Rails.root.to_s}/tmp/#{a.attachment_file_name}")
    # Delete it tempfile
    #File.delete("#{Rails.root.to_s}/tmp/#{a.filename}")
  end
10
задан TheExit 5 December 2010 в 04:53
поделиться