我有一個處理聯繫人電子郵件的控制器。我有一個這樣的動作:Rails - 電子郵件控制器重定向混淆
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。我已經嘗試過:回來,但它只是呈現代表性觀點。
那不能回答我的問題。我想從我來自的地方回來。你的建議總是會重定向到contact_representative_path。 – 2012-03-16 19:49:36
我想我已經錯過了你的問題的最後部分,編輯我的答案。 – asitmoharna 2012-03-17 03:25:31