連絡先メールを処理するコントローラーがあります。私はこのような行動をとっています:
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を試してみましたが、代表的なビューをレンダリングするだけです。