This project is archived and is in readonly mode.
to_xml generates invalid xml for arrays of namespaced ActiveRecords
Reported by Mark Foster | January 31st, 2010 @ 09:26 AM | in 3.0.2
The problem is similar to the one described in:
https://rails.lighthouseapp.com/projects/8994/tickets/2723-to_xml-g...
That patch applied to a single ActiveRecord with namespaces. It turns out that the same problem occurs in arrays of ActiveRecords with namespaces as well, e. g., those returned by find(:all).
The prior patch fixed options[:root] in to_xml for ActiveRecords . However, if the ActiveRecords are in an array, then the value of options[:root] is set in in activesupport/lib/active_support/core_ext/array/conversions.rb to_xml method and passed in to activemodel/lib/active_model/serializers/xml.rb and it contains invalid xml characters. Since options[:root] is not nil, the prior patch has no effect on correcting the invalid characters in arrays of namespaced ActiveRecords.
This patch strips out the invalid characters for any classes with namespaces from the root set in the array to_xml method.
Comments and changes to this ticket
-
Mark Foster January 31st, 2010 @ 09:33 AM
- Tag set to activerecord, array, class, modules, namespace, patch, to_xml, xml
Forgot tags on the ticket.
-
Yaroslav Markin January 31st, 2010 @ 11:41 PM
- Tag cleared.
Seems like I have the same thing at #3624.
-
Yaroslav Markin January 31st, 2010 @ 11:42 PM
- Tag set to activerecord, array, bug, patch, to_xml, xml
-
José Valim April 10th, 2010 @ 04:21 PM
- State changed from new to duplicate
-
Repository April 10th, 2010 @ 05:13 PM
- State changed from duplicate to resolved
(from [5850edf104ab1da0f72a43e6717a1270134db293]) Made arrays of ActiveRecords, and any classes, with namespaces convert to valid xml. [#3824 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/5850edf104ab1da0f72a43e6717a12... -
José Valim April 10th, 2010 @ 05:15 PM
- Milestone cleared.
Applied this one instead of #3624 since it applies on master.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3824 to_xml generates invalid xml for arrays of namespaced ActiveRecords (from [5850edf104ab1da0f72a43e6717a1270134db293]) Made ar...