ARes validation errors?

Just getting started with ActiveResource. If model validation fails
on the server side, will ARes map the xml error messages so that <%=
error_messages_for :model %> will still automagically work?

I’m trying to split a standard Rails app into front end vs. RESTful
web service, where the actual model validations are happening in the
web service, but I’m wondering how to glue back together the HTML
error messages on the form.

Any advice/insights?

Thanks
Jeff

Hey Jeff,

ARes will indeed map errors from xml to local ActiveResource error
objects.

http://api.rubyonrails.org/classes/ActiveResource/Validations.html
http://api.rubyonrails.org/classes/ActiveResource/Errors.html

On your “server” application the you’ll respond with render :xml =>
@object.errors.to_xml which generates xml like and these will be
automatically consumed by ARes.

On Feb 2, 3:41 pm, Trek [email protected] wrote:

automatically consumed by ARes.
Thanks Trek, I’ll give it a whirl.

Jeff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs