Topic: After a successfull AJAX validation I'm not redirected where I want
As the topic say I don't understand why I'm not redirected where I want after a successfull AJAX form submission.
Let me explain step by step.
At the beginning I'm in the new:
Started GET "/pay_checks/new" for 127.0.0.1 at Thu Oct 27 10:07:15 +0200 2011
Processing by PayChecksController#new as HTMLWhen I submit the form...
Started POST "/pay_checks" for 127.0.0.1 at Thu Oct 27 10:08:22 +0200 2011
Processing by PayChecksController#create as JSThe form is processed by the create controller as JS (its' ok)
In the create action, the format.js redirect to the index view path with a parameter...
format.js { redirect_to(pay_checks_url(:contract => @contract_id), :notice => 'Pay check was successfully created.') }And at the end of the processing I see
Redirected to http://localhost:3000/pay_checks?contract=4It's ok... I want to go there... but this is what happens:
Started GET "/pay_checks?contract=4" for 127.0.0.1 at Thu Oct 27 10:08:22 +0200 2011
Processing by PayChecksController#index as JS
...
Rendered pay_checks/index.html.erb within layouts/application (20.3ms)And I'm in the new! I'm not in the index as the log is saying.
I think that the problem is that I didn't set up the format.js n the index action, what sould I put there?
Thanks to all for the help