Ruby on rails 轨道。当自定义表单字段参数为时发送创建通知
如果填写了自定义表单字段,如何发送电子邮件Ruby on rails 轨道。当自定义表单字段参数为时发送创建通知,ruby-on-rails,actionmailer,Ruby On Rails,Actionmailer,如果填写了自定义表单字段,如何发送电子邮件 def create @act = Act.new(act_params) respond_to do |format| if @act.save ModelMailer.new_act_notification(@act).deliver_later if customer_id == '617' format.html { redirect_to @act, notice
def create
@act = Act.new(act_params)
respond_to do |format|
if @act.save
ModelMailer.new_act_notification(@act).deliver_later if customer_id == '617'
format.html { redirect_to @act, notice: 'Act was successfully created.' }
else
format.html { render action: "new" }
end
end
end
除非您设置变量customer\u id,否则这将不起作用。我想你想要的是:
ModelMailer.new_act_notification(@act).deliver_later if @act.customer_id == 617
我假设当您说“custom form field param”时,您是指@act
中对象的customer_id参数