Hello there!

I'm having some difficulty understanding how to serialize nested records in 
sequel.  After reading the documentation, it seems that I might be able to 
serialize a nested data model like so:

Class Foo
  one_to_many :bars

  plugin :json_serializer, {
    :include => {
      :bars => {
        :include => {
          :baz => {}
        }
      }
    }
  }
end

Class Bar
  one_to_one :baz
end

Class Baz
end

However, after calling Foo.new.to_json, and creating the associating 
records, I am returned a rather odd representation of JSON:

{"id" => 1, :bars => [{"json" 
=>"{\"id\":1,\"baz\":{\"json\":\"{\\\"id\\\"}}}}]}

As you can see, the Foo object (the root object) appears to render its 
attributes correctly, but the nested attributes not only have an 
undesirable "json" root key for their representation, but it also appears 
as they are being rendered as their stringified representation.

Is this expected?  Am I missing something?

The sequel version I'm using is: 4.7.0

Thanks!
-Kelly.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to