[Lift] mapper oddity

0 views
Skip to first unread message

harryh

unread,
May 7, 2010, 1:44:36 PM5/7/10
to Lift
Consider the following:

User.findAll(By(User.device_token, token))
.foreach(_.device_token(Empty).save)

device_token is a MappedString. One would guess that it cleared the
field (either set it to null or the empty string). In fact this bit
of code does nothing at all.

-harryh

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

David Pollak

unread,
May 7, 2010, 1:47:32 PM5/7/10
to lif...@googlegroups.com
On Fri, May 7, 2010 at 10:44 AM, harryh <har...@gmail.com> wrote:
Consider the following:

User.findAll(By(User.device_token, token))
   .foreach(_.device_token(Empty).save)

Hmmmm.... it shouldn't compile (please file a bug).

Mapper null is actually null... so _.device_token(null).save
 

device_token is a MappedString.  One would guess that it cleared the
field (either set it to null or the empty string).  In fact this bit
of code does nothing at all.

-harryh

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




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

harryh

unread,
May 7, 2010, 1:52:07 PM5/7/10
to Lift

> Hmmmm.... it shouldn't compile (please file a bug).

It compiles due to this (in MappedString):

def apply(ov: Box[String]): T = {
ov.foreach(v => this.set(v))
fieldOwner
}

Anyways, will file a bug.

> Mapper null is actually null... so _.device_token(null).save

That, on the other hand, does not compile. Though _.device_token(null:
String).save does. As does the, ugly, _.device_token(Full(null)).

David Pollak

unread,
May 7, 2010, 1:54:57 PM5/7/10
to lif...@googlegroups.com
On Fri, May 7, 2010 at 10:52 AM, harryh <har...@gmail.com> wrote:

> Hmmmm.... it shouldn't compile (please file a bug).

It compiles due to this (in MappedString):

Gaakkkk (the sound of Bill the Cat spitting up a hairball). ;-)
 

def apply(ov: Box[String]): T = {
 ov.foreach(v => this.set(v))
 fieldOwner
}

Anyways, will file a bug.

> Mapper null is actually null... so _.device_token(null).save

That, on the other hand, does not compile. Though _.device_token(null:
String).save does. As does the, ugly, _.device_token(Full(null)).

-harryh

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.


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

Reply all
Reply to author
Forward
0 new messages