Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails 3: client_side_validations throwing alert on running unique validation

I am using client_side_validations gem to perform a form validation in rails 3.

everything works fine except when the firefox/ie throws javascript alert when unique validation ajax runs and return 404 error message.

The author says a 404 means record not found and therefore unique;

Is there any way we can handle this.

I have opened this in : https://github.com/bcardarella/client_side_validations/issues/297

like image 537
dbKooper Avatar asked Mar 24 '12 20:03

dbKooper


1 Answers

The error you are seeing is because the remote validation cannot find the resource on the server. This is expected, if the resource is not found the resource is unique.

While I think this is the semantically correct status code to return and I do not think the browsers should be showing errors for this I am clearly going to lose. So in the next version of ClientSideValidations I will be changing this behavior to return a status code in the 2xx range. Sorry for the confusion.

like image 136
bcardarella Avatar answered Oct 25 '22 22:10

bcardarella