How to fix "No implicit view available ..." error triggered by By.apply(field,value)(implicit ev) in MetaMapper.scala

31 views
Skip to first unread message

Baskaran S

unread,
Oct 16, 2021, 9:20:38 AM10/16/21
to Lift
As a beginner, I am trying out examples from Lift In Action written for 2.x using Lift 3.5.0.

Resolved few deprecation errors and then ended up with a compilation error. Can you help me fix this error?

[error] .../example/travel/model/Auction.scala:81:28: No implicit view available from Auction.this.id.type => Long.
[error]   def bids = Bid.findAll(By(Bid.auction, this.id), OrderBy(Bid.id, Descending))
[error]                            ^
[error] one error found

MetaMapper.scala, object By, from github url.
object By {
  ...
  def apply[O <: Mapper[O], T, U](field: MappedField[T, O], value: U)(implicit ev: U => T) = Cmp[O,T](field, Eql, Full(value), Empty, Empty)
  ...
}

Thanks in advance
- Baskaran

Baskaran S

unread,
Oct 16, 2021, 10:00:40 AM10/16/21
to Lift
Replaced: def bids = Bid.findAll(By(Bid.auction, this.id), OrderBy(Bid.id, Descending))
with:     def bids = Bid.findAll(By(Bid.auction, this.id)(_.get), OrderBy(Bid.id, Descending))

It compiles, but is it correct?

- Baskaran

Reply all
Reply to author
Forward
0 new messages