Normally you'd probably do something like
i.category.obj.map(_.name).openOr("unknown category!")
That is, if I have a category object give me its name, otherwise give
me "unknown category!"
Also, if you have to collect the result a bunch of possibly-failing
computations (like looking up the category can fail) then remember
that the for comprehension is your friend.
-Ross
On Dec 23, 2009, at 4:45 PM, Jim Wise wrote:
> Jim Wise <[email protected]> writes:
>
>> "category" ->
>> i.category.obj.open_!.name, // XXX safe unless key rel is
>> corrupt ?
>> AttrBindParam("imgUrl", i.url, "src")
>
> And, since I'm looking at this code, what's the safe way to do this
> (i.e. can I avoid the open_!)?
>
> --
> Jim Wise
> [email protected]
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.