Re: [Rails] JSON response , error message

2012-10-28 Thread Jordon Bedwell
On Sun, Oct 28, 2012 at 12:26 AM, Saravanan P saravana...@shriramits.com wrote: render :json = { :errors = @example.errors.full_messages }, :status = 422 Why are you sending a 422? If you really want to stick in the 400 range it would be more suitable to send a 409 conflict since it literally

Re: [Rails] JSON response , error message

2012-10-28 Thread Katja Kokatjuhha
in your js file: $('.form_id_or_class').live('submit', function() { $.ajax({ url: $(this).attr(action), type: POST, data: $(this).serialize(), success: function(data) { // do some action } ,error: function(xhr){

Re: [Rails] JSON response , error message

2012-10-28 Thread Matt Jones
On Sunday, 28 October 2012 02:07:27 UTC-4, Jordon Bedwell wrote: On Sun, Oct 28, 2012 at 12:26 AM, Saravanan P sarav...@shriramits.com javascript: wrote: render :json = { :errors = @example.errors.full_messages }, :status = 422 Why are you sending a 422? If you really want to stick

[Rails] JSON response , error message

2012-10-27 Thread Akvarel
Hello I am trying to show the errors that can occur by uploading a file (file name, size). I need have your error messages associated to the 'error' key in my json response else format.html { render action: new } format.json { render json: @upload.errors, status: :unprocessable_entity }

Re: [Rails] JSON response , error message

2012-10-27 Thread Saravanan P
in your controller: render :json = { :errors = @example.errors.full_messages }, :status = 422 in your js file: $('.form_id_or_class').live('submit', function() { $.ajax({ url: $(this).attr(action), type: POST, data: $(this).serialize(), success: