I have several Mapper classes with a MappedLongForeignKey field that
is nullable/optional.
When the Mapper instance does not have a concrete reference/value for
that foreign key field, the call to asJsExp on the Mapper instance
produces a zero (0) for the MappedLongForeignKey value. Technically,
I don't believe this is correct; I think it should emit a JE.JsNull.
Before raising this issue, I searched the Issue Tracker and discovered
Issue 282 was a very similar issue raised for asJsonValue:
https://www.assembla.com/spaces/liftweb/tickets/282?batch=&tickets_report_id=10&ticket_id=282&commit=Go+%C2%BB
It would seem that a fix was added to asJsonValue, but a similar fix
was never applied to asJsExp.
(Another idea is to have MappedLongForeignKey leverage
MappedNullableLong rather than MappedLong -- but that idea was
mentioned in Ticket 282, yet not done.)
(Note that I stumbled across this issue with Lift 2.2, but it doesn't
look like this was changed with Lift 2.3. I am temporarily overriding
asJsExp, but ultimately would like to see Lift fixed if we can all
agree that this is a bug/oversight.)