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.

should serialize yaml fails in ActiveModel

#4650

There is 1 failure in the testsuite of ActiveModel, Rails master on 1.9.2-head

The stacktrace is as follows:

1) Failure: test_should_serialize_yaml(XmlSerializationTest) [/home/rohit/remote-repos/rails_patches/working3/activemodel/test/cases/serializeration/xml_serialization_test.rb:107]:
Expected /\n\n aaron stack\n

Thanks to DefV from #rails-contrib, who has confirmed that the tests pass on 1.8.7

I noticed that on 1.9.2 the output of serializing the yaml was:

Note that a field(is it a field?) modifiable: true is extra on 1.9.2. I tried looking at the OpenStruct docs and did a little Googling around but couldn't find any more information.

Reported by Rohit Arondekar · May 19th, 2010 @ 08:59 AM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Rohit Arondekar
    Rohit Arondekar

    LH just ate the stack trace, here is a pastie: http://pastie.org/pastes/967219

    May 19th, 2010 @ 09:00 AM

  2. Rohit Arondekar
    Rohit Arondekar

    Nooo! LH also ate the comparison :(. I've included it in another pastie, http://pastie.org/967270

    May 19th, 2010 @ 09:05 AM

  3. Jan De Poorter
    Jan De Poorter

    Looks like this change adds @modifiable variable to OpenStruct if you call a setter method on an OpenStruct. If you create the OpenStruct with values in the initializer the test passes

    Fri Feb 27 14:23:09 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
    
    * lib/ostruct.rb (modifiable): check if really frozen.
      [ruby-core:22559]
    

    Patch attached.

    May 19th, 2010 @ 09:46 AM

  4. Rohit Arondekar
    Rohit Arondekar

    +1 for the patch BUT, what if the programmer can't use the initializer to create the struct, what if he has to use setter methods? Shouldn't Rails remove the modifiable: true from the output? Because it's not semantically part of the struct the programmer created.

    May 19th, 2010 @ 10:53 AM

  5. Rizwan Reza
    Rizwan Reza
    • No changes were found…

    May 19th, 2010 @ 11:00 AM

  6. Rizwan Reza
    Rizwan Reza
    • No changes were found…

    May 19th, 2010 @ 11:26 AM

  7. Anil Wadghule
    Anil Wadghule

    I think we can use any other ruby object of other class e.g. Struct. OpenStruct behaves differently on different rubies. See here http://pastie.org/967363. I am sumitting a patch.

    May 19th, 2010 @ 11:52 AM

  8. Anil Wadghule
    Anil Wadghule

    Attached is a patch to resolve this issue

    May 19th, 2010 @ 11:58 AM

  9. José Valim
    José Valim

    Thanks Anil! Can you please rebase your patch? For some reason it does not apply anymore.

    May 19th, 2010 @ 12:01 PM

  10. José Valim
    José Valim
    • Milestone cleared.
    • State changed from new to resolved

    Sorry, I was applying it in the wrong repo! The patch applies with success! :P

    May 19th, 2010 @ 12:02 PM

  11. Repository
  12. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM