What I want to do:

Create a one-to-zero-or-one relationship between User and Address.
I.e. User belongs to Address.

When a new user signs up for an account they need to fill in an
address form at that same time. So the user.address object needs to be
initialised properly when the user object is created. (this part is
working ok).

I also want (for backwards compatibility) existing users to get a new
Address object when they update their profile if they currently don't
have an address. I.e. in the users table the address foreign key is
null. (this part nearly works)

What the problem is:

When a new user signs up it seems to work fine. The address is saved
in the database and the foreign key is set on the user.

However, when there is an existing user with no address (the
user.address FK is NULL), they fill in the form and click update. The
address is saved into the database, BUT the user.address FK is not set
in the users table. It remains NULL.

I have tried various combinations of things such as primeObj(), apply
() and LongMappedForeignMapper, but I don't understand why the FK is
not being updated.

Here is my User.scala
http://gist.github.com/169639

and my Address.scala
http://gist.github.com/169638

I also have a hello-lift app that demonstrates this problem if it's
useful.

Thanks in advance!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to