Closed
Description
I am not sure if this is related, but we are still facing the same issue in Rails-7.2.1 and activerecord-sqlserver-adapter 7.2.1.
.where('date_column < ?', date)
is throwing "undefined method `value_for_database'"
Originally posted by @aaronsajo in #1166 (comment)
I also came across this today.
where("written_on < ?", Time.now) ✅
where("written_on < ?", Date.today) ❌
where("written_on < ?", DateTime.current) ❌
So, it seems to work only for Time objects, but not Date or DateTime objects.Adding checks for type.is_a?(Date) || type.is_a?(DateTime) in #basic_attribute_type? would fix these specific cases, but I don't know the codebase well enough to say, if this would break something else.