Rails: What is 'my' in ActiveRecord where class

135 Views Asked by At

It's very strange. I don't see any documentation for the usage of 'my' in where class. Can anyone please explain the below.

1.9.3-p547 :006 >  reser = Date.today
 => Thu, 18 Dec 2014
1.9.3-p547 :011 > Reservation.where { start_date >= reser }.count
   (0.8ms)  SELECT COUNT(*) FROM "reservations" WHERE "reservations"."start_date" >= '2014-12-18'
 => 63
1.9.3-p547 :012 > Reservation.where { start_date >= my { reser } }.count
   (0.8ms)  SELECT COUNT(*) FROM "reservations" WHERE "reservations"."start_date" >= '2014-12-18'
 => 63 
1

There are 1 best solutions below

2
On

It comes from the squeel gem that extends AR. See the Query DSL.