【发布时间】:2010-12-05 01:46:22
【问题描述】:
我有一个回形针文件,我想将它作为附件添加到我的电子邮件中......
类 UserMailer
attachments ??? How to add a paperclip file?
mail( :to => "#{record.email}",
:subject => "XXXXXXXX"
)
end
google 上似乎没有关于该主题的内容,如果您有任何想法,我很想听听 :)
谢谢
更新
@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
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 paperclip actionmailer