Hi Tim,

The only reason why I reported this as an error is because my attempts to
use CRUDify in this way resulted in compile errors.  If Transaction is using
CRUDify, then Transaction.menus returns List[Menu].  Hence, the example
effectively does this:

List[Product] = Menu :: List[Menu] :: Nil

Since SiteMap accepts a vararg array of Menu*, turning the List[Product]
into an array places the whole List[Menu] in the second position.  For
example, with this code...

    val menu = Menu(Loc("Home", List("index"), "Home")) :: Project.menus ::
Nil
    LiftRules.setSiteMap(SiteMap(menu:_*))

I get this compile error:
[INFO]  found   : List[Product]
[INFO]  required: Seq[net.liftweb.sitemap.Menu]
[INFO]     LiftRules.setSiteMap(SiteMap(menu:_*))

You are correct that simply changing the :: to ::: will not work (I
oversimplified because I have many CRUDify menus).  If you remove the "::
Nil" from the above line of code, all is well.  Subsequent CRUDify menus
then need to be appended using ::: to merge the list, or the list could
probably be flattened just before passing to the SiteMap. As written, the
example doesn't work for me.  I am using Lift 1.0 in my prototyping.

On Mon, Mar 9, 2009 at 4:23 AM, Timothy Perrett <[email protected]>wrote:

>
>
> >
> > I believe the typo is in listing 6.36, shown below.
> >
> >     val menus = ... Menu(Loc(...)) :: Transaction.menus :: Nil
> >     LiftRules.setSiteMap(SiteMap(menus : _*))
> >
> > This should be using the ::: operator instead of :: because the CRUDify
> > menus are returned as Lists.  Using the :: would assign a List[Product]
> > instead of the required Seq[Menu].
>
> James,
>
> This is not an error - the difference between :: and ::: is that ::
> appends the new item to the given List[T] and ::: prepends to the
> given List[T]
> If you would like to know more about sitemap check out:
>
> http://wiki.liftweb.net/index.php?title=SiteMap
>
> Cheers, Tim
> >
>

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

Reply via email to