Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

scoped models serialize into invalid xml

#1160

The ActiveRecord::XmlSerializer creates invalid xml when serializing models within a scope.


>> puts Myscope::Mymodel.first.to_xml
<myscope/mymodel>
...
</myscope/mymodel>

This xml is invalid because you are not allowed slashes in a node name. The invalid node name is caused by the way XmlSerializer converts a model's class name into the xml root string


record.class.to_s.underscore

( in xml_serializer.rb on lines 180 and 223 )

I offer this as a possible fix


record.class_name.underscore

Reported by deadlyicon · October 2nd, 2008 @ 11:21 PM

State: invalid
Milestone: none
Assigned to: Pratik Pratik
Importance: none

Activity

  1. deadlyicon
  2. Pratik
    Pratik
    • Milestone cleared.
    • State changed from new to incomplete
    • Assigned user set to Pratik

    Looks good. Missing tests.

    January 18th, 2009 @ 06:07 AM

  3. Ryan Bigg
    Ryan Bigg

    Tested in 2.3.5, this now outputs <scope-model>. I think this ticket can now be closed.

    April 10th, 2010 @ 11:23 AM

  4. Rishav Rastogi
  5. deadlyicon
    deadlyicon

    is this still a problem? =\

    April 10th, 2010 @ 11:48 AM

  6. Ryan Bigg
    Ryan Bigg
    • State changed from incomplete to invalid

    April 11th, 2010 @ 04:52 AM