我有一个处理联系电子邮件的控制器。我有这样的动作:
def representative
@contact = UserContact.new()
if request.method == 'POST'
@contact = UserContact.new(params[:merchant_contact])
if @contact.valid?
@contact.contact_email = current_user.email
@contact.contact_phone = current_user.phone_number
Emailer.representative_contact(@contact, representative).deliver # sends the email
redirect_to **????**, :flash => { :notice => "Thank you! Someone will get back to you shortly."}
else
render :representative
end
else
render :representative
end
end
我从代码中的不同位置调用contact_representative_path,我希望在提交重定向到用户单击contact_representative_path的位置之后。我尝试过使用 :back,但它只是呈现了代表性视图。