【发布时间】:2012-04-02 08:34:36
【问题描述】:
我有一个处理联系电子邮件的控制器。我有这样的动作:
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,但它只是呈现代表性视图。
【问题讨论】:
标签: ruby-on-rails redirect referer