{"action":"created","issue":{"url":"https://api.github.com/repos/apotonick/roar/issues/144","labels_url":"https://api.github.com/repos/apotonick/roar/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/apotonick/roar/issues/144/comments","events_url":"https://api.github.com/repos/apotonick/roar/issues/144/events","html_url":"https://github.com/apotonick/roar/issues/144","id":72146379,"number":144,"title":"Testing: to_xml -> from_xml with collections.","user":{"login":"akashirin","id":10236990,"avatar_url":"https://avatars.githubusercontent.com/u/10236990?v=3","gravatar_id":"","url":"https://api.github.com/users/akashirin","html_url":"https://github.com/akashirin","followers_url":"https://api.github.com/users/akashirin/followers","following_url":"https://api.github.com/users/akashirin/following{/other_user}","gists_url":"https://api.github.com/users/akashirin/gists{/gist_id}","starred_url":"https://api.github.com/users/akashirin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akashirin/subscriptions","organizations_url":"https://api.github.com/users/akashirin/orgs","repos_url":"https://api.github.com/users/akashirin/repos","events_url":"https://api.github.com/users/akashirin/events{/privacy}","received_events_url":"https://api.github.com/users/akashirin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-30T12:43:03Z","updated_at":"2015-05-01T06:22:08Z","closed_at":null,"body":"Hello.\r\n\r\nI'd like to use Roar in a Sinatra-based project that provides an XML API. Trying to be convinced that the from_xml of a to_xml's output produces the original data. All is ok until using collections of compound objects. For example:\r\n```\r\nclass Song < OpenStruct  \r\nend\r\nclass Comp < OpenStruct  \r\nend\r\n\r\nclass CompDecorator < Roar::Decorator\r\n  include Roar::XML\r\n  property :name\r\nend\r\n\r\nclass SongDecorator < Roar::Decorator\r\n  include Roar::XML\r\n  property :title\r\n  collection :composers, decorator: CompDecorator, class: Comp\r\nend\r\n\r\nsong = Song.new(title: \"Roxanne\", composers: [Comp.new(name:\"Sting\"), Comp.new(name:\"Stu Copeland\")])\r\nputs \"INPUT:    \" + song.inspect\r\n\r\ndoc = SongDecorator.new(song).to_xml\r\nputs \"TO_XML:   \" + doc\r\n\r\nsong = Song.new\r\nSongDecorator.new(song).from_xml(doc)\r\nputs \"FROM_XML: \" + song.inspect\r\n```\r\nOutput:\r\n------\r\n```\r\nINPUT:    #<Song title=\"Roxanne\", composers=[#<Comp name=\"Sting\">, #<Comp name=\"Stu Copeland\">]>\r\n```\r\n```\r\nTO_XML:   <song_decorator>\r\n  <title>Roxanne</title>\r\n  <comp_decorator>\r\n    <name>Sting</name>\r\n  </comp_decorator>\r\n  <comp_decorator>\r\n    <name>Stu Copeland</name>\r\n  </comp_decorator>\r\n</song_decorator>\r\n```\r\n```\r\nFROM_XML: #<Song title=\"Roxanne\">\r\n```\r\nThe same result when i'm using the Extend strategy (- representers instead of decorators).\r\nAm I misunderstanding something? \r\nPlease help. Thx.\r\n"},"comment":{"url":"https://api.github.com/repos/apotonick/roar/issues/comments/98057459","html_url":"https://github.com/apotonick/roar/issues/144#issuecomment-98057459","issue_url":"https://api.github.com/repos/apotonick/roar/issues/144","id":98057459,"user":{"login":"akashirin","id":10236990,"avatar_url":"https://avatars.githubusercontent.com/u/10236990?v=3","gravatar_id":"","url":"https://api.github.com/users/akashirin","html_url":"https://github.com/akashirin","followers_url":"https://api.github.com/users/akashirin/followers","following_url":"https://api.github.com/users/akashirin/following{/other_user}","gists_url":"https://api.github.com/users/akashirin/gists{/gist_id}","starred_url":"https://api.github.com/users/akashirin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akashirin/subscriptions","organizations_url":"https://api.github.com/users/akashirin/orgs","repos_url":"https://api.github.com/users/akashirin/repos","events_url":"https://api.github.com/users/akashirin/events{/privacy}","received_events_url":"https://api.github.com/users/akashirin/received_events","type":"User","site_admin":false},"created_at":"2015-05-01T06:22:08Z","updated_at":"2015-05-01T06:22:08Z","body":"It helps. Thank you."}}