Try mixing in LongMappedForeignMapper to address, or calling 
address.primeObj(addressObj).
What doesn't work the way you tried?

-------------------------------------
george<geo...@mattandgeorge.com> wrote:


I have extended MegaProtoUser in order to add a related Address object
which is a MappedLongForeignKey.

The idea being simply that there is a 1 to 1 relationship between a
User and their Address.

When a new User object is instantiated (but not yet persisted), I want
to be able to get the related address object like this:

user.address.obj

But the returned Box is always empty, I guess because nothing has been
saved yet.

I need to somehow initialise the address if it is Empty otherwise
return the current Address.

I thought something like this would work, but it doesn't:

user.address.obj.openOr(user.address(new Address).address.obj.open_!)

Anyone know how to do this properly?


--~--~---------~--~----~------------~-------~--~----~
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