This project is archived and is in readonly mode.
[PATCH] to_xml doesn't support nested structures and other inconstancies
-
CancelProfileIsBroken
- Tag changed from activerecord, bug, patch, serialization, to_xml, xml to activerecord, bug, bugmash, patch, serialization, to_xml, xml
-
Elomar França
- Agree with the fixes, but the patch doesn't apply neither on master nor on 2-3-stable.
-
Nick M
I think this updated patch should apply to master again. Let me know if there are still problems with it.
I can bring this same functionality back to 2-3-stable, but things are organized a bit differently there, so I'd just have to spend a bit of time sorting all that out and creating a separate patch. I think it would be great if these changes could be applied to 2.3 (they should be completely backwards compatible with what used to work correctly), but I wanted to see if others agreed before producing another patch for 2.3.
-
Rizwan Reza
- Tag changed from activerecord, bug, bugmash, patch, serialization, to_xml, xml to activerecord, bug, patch, serialization, to_xml, xml
-
Christos Trochalakis
We are building a json/xml api and the xml output is broken due to this bug, we would love to see this pushed to both master and 2.3 branch. JSON doesn't have those issues due to the as_json propagation, so implementing
as_xmlmethod seems like the right thing to do.ps: the patch has become outdated
-
Neeraj Singh
@Christos Trochalakis Can you please elaborate what part of xml output you don't like in the give below scenario.
ActiveRecord::Schema.define(:version => 20100514192542) do create_table "reports", :force => true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end end class Report < ActiveRecord::Base def item_ids [8,9] end def metadata {:color => 'blue', :options => [:blue, :red]} end def self.lab Report.first.to_xml(:methods => [:item_ids, :metadata]) end end #rails -v : Rails 3.0.0.beta3 #ruby -v : ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.3.0]Report.lab comes out to be
<name>GDP growth</name> <created-at type="datetime">2010-05-14T19:29:20Z</created-at> <updated-at type="datetime">2010-05-14T19:29:20Z</updated-at> <id type="integer">1</id> <item-ids type="array"> <item-id type="integer">8</item-id> <item-id type="integer">9</item-id> </item-ids> <metadata> <color>blue</color> <options type="array"> <option type="symbol">blue</option> <option type="symbol">red</option> </options> </metadata>The xml looks good to me.
-
Santiago Pastorino
- State changed from new to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
