instance method
compare_with_coercion
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.0.20Signature
compare_with_coercion(other)
Layers additional behavior on DateTime#<=> so that Time and ActiveSupport::TimeWithZone instances can be compared with a DateTime
Parameters
-
otherreq
Source
# File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 108
def compare_with_coercion(other)
other = other.comparable_time if other.respond_to?(:comparable_time)
other = other.to_datetime unless other.acts_like?(:date)
compare_without_coercion(other)
end
Defined in activesupport/lib/active_support/core_ext/date_time/calculations.rb line 108
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateTime