我試圖創建一個感謝您網頁,我的這條路線,因爲我測試的URL和工作得很好工作正常,但是當我嘗試在創建操作重定向我得到:如何創建一個感謝頁面?
Routing Error
No route matches {:action=>"thank_you", :locale=>:en, :controller=>"appointments"}
控制器
def create
@appointment = Appointment.new(params[:appointment])
if @appointment.save
#send email
AppointmentMailer.appointment_confirmation(@appointment).deliver
AppointmentMailer.new_appointment(@appointment).deliver
redirect_to :action => "thank_you"
else
render :action => 'new', :alert => @appointment.errors.full_messages.split(', ')
end
end
def thank_you
@appointment = Appointment.find(params[:id])
end
路線
resources :appointments, :except => :new do
member do
get :thank_you
end
end
我做了,我已經將路線代碼添加到pos,並且仍然出現錯誤。 – evanx
@evanx您是否重新啓動? –
是的。沒有路線匹配{:action =>「show」,:controller =>「schedules」,:locale =>:en,**:id => nil **}。 @DaveNewton – evanx