Malformed XML

Hey all,

rails 2.1

When I do this from the controller:

render :xml => @address.errors, :status => :unprocessable_entity

I get a malformed root node in the XML

<active-record/errors type=“array”> … </active-record/errors> #
note the extra slashes

However when I do this in the console:

address.errors.to_xml

I get the following which seems fine:

Any ideas on why the discrepancy and perhaps a fix for the controller
bit?

Thanks in advance!
Tim

Tim wrote:

Hey all,

rails 2.1

Any ideas on why the discrepancy and perhaps a fix for the controller
bit?

Odd. I just tried this out of curiosity in Rails 2.3.3 and it worked as
expected:

<?xml version="1.0" encoding="UTF-8"?> Title can't be bland

A Rails 2.1 bug possibly??

Robert W. wrote:

<?xml version="1.0" encoding="UTF-8"?> Title can't be bland

Obviously, titles must be interesting to be accepted. hehe. Sorry, I
meant to type “blank.”

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