SFEley / candy

Transparent persistence for MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Objects to be embedded getting saved to the database

SFEley opened this issue · comments

Doing this:

u = User.new
p = Payment.embed
p.date = Time.now
p.amount = 5.00
u.payment = p

...results in a Payment collection being made and the Payment record going into it, where it will hang around as a duplicate of the one the User has.

This is not right, and it's what the .embed method was supposed to be for. Make sure initializing with that method never saves anything to the DB.