On Wed, Sep 16, 2009 at 10:58 AM, Tobias Daub <hannes.flo...@gmx.li> wrote:

>
> Hey Lifters,
>
> Simple problem, but kind of difficult solution:
>
> I've a foreign key field, e.g. myField. I want to get the id of the field.
>
> So I wrote a method inside the class:
>
> def getMyFieldId = myField.obj.map(_.id.is) openOr 0L
>

// why load the object and ask for its id when you already know the id?

def getMyFieldId = myField.is


>
> IDs always start with one, right?
>
> But I get zero back! Why? I definitely know that this foreign key
> exists, because I can print another field value from the foreign key
> object inside some form...? That doesn't make any sense to me.
>
> thanks and sorry for always asking the same questions.
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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