Topic: [SOLVED] Validation errors return with 200 status?

UPDATE:  solved.  There was a minor mis-step in the tutorial.  Problem was that I wasn't specifying the status over-ride in the correct place.

I've been trying to get ajax and rails 3 working for a simple task:
On my timesheet controller's view page,  I want to create new billable. 

I used to do this easily with a nice form-remote-for and prototype, but all the gurus say I need to be running R3 and JQuery...that's fine and I can see why, but I'm really baffled.   I'm following this tutorial, but getting different results from they seem to imply I should be getting:

http://www.alfajango.com/blog/rails-3-r … and-forms/

Namely, when I submit a form as ajax, validation errors return as "success".

Ok, no problem, I think to myself...that makes a certain sense since that WAS a successful interaction with the server.  But not getting the results that the tutorial indicated made me nervous and put me once again in trying to understand this from scratch land.  So I just have it re-render the form...

Only now the re-rendered form that nicely displays my validation errors is de-ajaxed and does a straight-submit.   Of course!  IT wasn't there at load time so rails.js couldn't link it in...So then I think: Ok, I'll just start hacking at rails.js to make it re-ajax my forms on any ajax:complete and then I paused...

WTF am I doing...this can't be how I'm supposed to be doing this.  It seems like way too much work for a rails project to get a simple post with validation working in ajax.

I'm using the latest jquery, the latest rails.js, and rails v 3.0.4.

Last edited by Hamoth (2011-03-04 03:23:02)

High-Tech Creative Services http://new.techism.com/