我試圖在發送郵件後更新名爲lastemailed的屬性,但無法使其工作。我試過把它放在我的控制器和郵件模型中,但它沒有奏效。這是我正在使用的代碼。謝謝你的幫助!郵寄郵件後更新屬性
郵寄/ page_mailer.rb
class PageMailer < ActionMailer::Base
add_template_helper(PagesHelper)
default from: "[email protected]"
def reminder_send(user)
@user = user
mail(to: "#{@user.email}", subject: "Your subject")
end
end
pages_controller.rb
def send_reminder_mail
@user = User.find(params[:id])
PageMailer.reminder_send(@user).deliver
flash[:notice] = "Reminder sent!"
redirect_to '/employees'
end
認爲調用郵件
<%= link_to "Email", :controller => "pages", :action => "send_reminder_mail", :id => u.id %>
的郵件工作正常,我只是不能得到屬性更新。謝謝!