我正在尝试创建一个感谢页面,我的路线运行良好,因为我测试了它的 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