I have made a test that worked. I have modified my code like this:
newUser.save
newUser.devices += newDevice
newUser.save
The newDevice was already saved. It looks like both parents
On Mon, Oct 26, 2009 at 11:43 AM, GA my_li...@me.com wrote:
I have made a test that worked. I have modified my code like this:
newUser.save
newUser.devices += newDevice
newUser.save
Thanks for the answer.
I understand now. But I have a follow up question. This is the code
for my relationship table, which I've done following some examples and
previous discussions about this subject:
class UserDevice extends LongKeyedMapper[UserDevice] with IdPK {
def getSingleton =
It would be feasible to refactor ManyToMany to remove this restriction.
OneToMany does not require either side to be saved first.
Can you describe a use case where it would be desirable?
-
Jim Barrowsjim.barr...@gmail.com wrote:
On Mon, Oct 26, 2009 at 11:43
On Mon, Oct 26, 2009 at 12:05 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:
It would be feasible to refactor ManyToMany to remove this restriction.
OneToMany does not require either side to be saved first.
Can you describe a use case where it would be desirable?
I don't think there is.
What do you mean by that? Every primary key is unique.
-
Jim Barrowsjim.barr...@gmail.com wrote:
On Mon, Oct 26, 2009 at 12:05 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:
It would be feasible to refactor ManyToMany to remove this restriction.
On Mon, Oct 26, 2009 at 2:36 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:
What do you mean by that? Every primary key is unique.
The pivot table is typically only 2 columns, which are the PK's for each
side of the MTM.
---- ---
Do you mean foreign keys? Why does that preclude linking them before they're
saved? OneToMany also uses a foregn key / primary key relationship, and you can
use LongMapperMapper.
-
Jim Barrowsjim.barr...@gmail.com wrote:
On Mon, Oct 26, 2009 at 2:36 PM,