I want to be able to compare Dates and Times in Rails without always having to call the to_time or to_date method. So I wrote the following code:
class Date
def ==(other)
if other.kind_of?(Time)
self.to_time == other
else
super(other)
end
end
end
I know there's an easy way to write this so that I can make this work for >, <, >=, <= and <=>. But I forgot how :P Any ideas?