Serialize ( to_json ) association is not working for non-embedded documents.

18 views
Skip to first unread message

Aditi

unread,
Jan 25, 2012, 7:05:46 AM1/25/12
to MongoMapper, kira...@gmail.com
Hello,

I have this scenario

class A
include MongoMapper::Document
belongs_to: bs, :class => B
end

class B
include MongoMapper::Document
end

I want to be able to serialize 'bs' when I serialize an instance of
'A'.

Right now this is not happening.

The serialization works however if I make B a embedded document. I saw
unit test in mongo_mapper code base and there are unit tests only for
embedded document scenario.

Is serializing non-embedded associations even supported ? What are the
other alternatives ?

Thanks in advance

Aditi




John Nunemaker

unread,
Feb 4, 2012, 6:04:38 PM2/4/12
to mongo...@googlegroups.com
Why would you want to serialize an entire document with another and also store it in a separate collection?


Aditi




--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en

Reply all
Reply to author
Forward
0 new messages