出于某种原因,当我在 where 中使用 Date 类时会被识别
scope :with_active_subthing, joins("left outer join thing_subthing on thing_subthing.patient_id = thing.id").where("thing_subthing.start_date <= ? AND ( thing_subthing.end_date > ? OR thing_subthing.end_date IS NULL ) ", Date.today, Date.today)
但是当我在连接中使用它时无法识别它
scope :with_active_subthing, joins("left outer join thing_subthing on thing_subthing.patient_id = thing.id AND (thing_subthing.start_date <= ? AND ( thing_subthing.end_date > ? OR thing_subthing.end_date IS NULL )) ", Date.today, Date.today)
我得到:
RuntimeError: unknown class: Date