Aaah! Thank you very much! That fixed it!

On 6 Dez., 07:42, Alex Boisvert <alex.boisv...@gmail.com> wrote:
> Your issue is that "u.customer" returns a MappedLongForeignKey instance, not
> a Customer.
>
> You probably want to use "u.customer.get" or "u.customer.can" or something
> like that.
>
> alex
>
> On Sat, Dec 5, 2009 at 5:50 PM, Franz Bettag <fr...@bett.ag> wrote:
> > Heyho,
>
> > i'm running 1.1-m7 and having the following issue. i am using the
> > basic user model and created a model Customer like this:
>
> > class Customer extends LongKeyedMapper[Customer] with IdPK {
> >        def getSingleton = Customer
>
> >        object name extends MappedString(this, 255)
> >        def users: List[User] = User.findAll(By(User.customer, this.id))
>
> > }
>
> > object Customer extends Customer with LongKeyedMetaMapper[Customer] {
> >        override def fieldOrder = List(name)
> >        override def dbIndexes = List(Index(IndexField(name)))
>
> > }
>
> > in my user model i got:
> > object customer extends MappedLongForeignKey(this, Customer)
>
> > the idea is, that i have a trait called "Customerize" which will add a
> > customer-object/field into the desired model and that those fields get
> > auto-set on create depending on User.currentUser.customer.
>
> > So far it looks like this:
>
> > trait CustomerFields[A <: Mapper[A]] {
> >        this: A =>
>
> >        private val thisTyped = this.asInstanceOf[A]
>
> >        object customer extends MappedLongForeignKey(thisTyped, Customer)
> > with LifecycleCallbacks {
> >                override def beforeCreate: Unit =
> >                        User.currentUser match {
> >                                case Full(u: User) => {
> >                                                u.customer match {
> > ->>                                                     case Full(c:
> > Customer) => this(c)
> >                                                        case _ => false
> >                                                }
> >                                        }
> >                                case _ => false
> >                        }
>
> >        }
>
> > }
>
> > The marked line errors like the following:
>
> > [ERROR] Customerize.scala:49: error: constructor cannot be
> > instantiated to expected type;
> > [INFO]  found   : net.liftweb.common.Full[A]
> > [INFO]  required: object u.customer
> > [INFO]                                                  case Full(c:
> > Customer) => this(c)
>
> > [ERROR] Customerize.scala:49: error: not found: value c
> > [INFO]                                                  case Full(c:
> > Customer) => this(c)
>
> > Any ideas/suggestions? :)
>
> > best regards
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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