candy icon indicating copy to clipboard operation
candy copied to clipboard

Objects to be embedded getting saved to the database

Open SFEley opened this issue 15 years ago • 0 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.

SFEley avatar May 09 '10 17:05 SFEley