So, this is probably a usage error... but I hope somebody knows how to make this work. I''m trying to use a RESTful ActiveResource client and print the attribute validation errors for model attributes during an update operation. I''ve been following one of the threads, and am returning a response from the server as follows: format.xml { render :xml => m.to_xml, :status => ''400 BadRequest'' } The ActiveResource client seems to like it... the "model.save" returns false, so the response was understood etc. The model has error fields in it which work good on the standard HTML forms, so I think this is OK as well. However, I cannot seem to figure out how to actually get at the errors on the client-side. A call to model.errors, model.full_errors, model.errors.each etc. returns nothing. So, my suspicion is that the the data is not being sent by the server at all. Is this a current limitation? or just plain ignorance on my part? - Reid --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Reid van Melle
2006-Nov-20 10:06 UTC
Re: retrieving ActiveResource validation errors on attributes
Please ignore... wrong list. I apologize. - R On 11-Nov-06, at 7:50 PM, rvanmelle wrote:> > So, this is probably a usage error... but I hope somebody knows how to > make this work. > > I''m trying to use a RESTful ActiveResource client and print the > attribute validation errors for model attributes during an update > operation. > > I''ve been following one of the threads, and am returning a response > from the server as follows: > > format.xml { render :xml => m.to_xml, :status => ''400 BadRequest'' } > > The ActiveResource client seems to like it... the "model.save" returns > false, so the response was understood etc. The model has error fields > in it which work good on the standard HTML forms, so I think this > is OK > as well. > > However, I cannot seem to figure out how to actually get at the errors > on the client-side. A call to model.errors, model.full_errors, > model.errors.each etc. returns nothing. So, my suspicion is that the > the data is not being sent by the server at all. > > Is this a current limitation? or just plain ignorance on my part? > > - Reid > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---