Skip to content

Instantly share code, notes, and snippets.

@changa
Created November 21, 2014 17:41
Show Gist options
  • Save changa/c8549f0c07f9a7df6774 to your computer and use it in GitHub Desktop.
Save changa/c8549f0c07f9a7df6774 to your computer and use it in GitHub Desktop.
Strange ActiveSupportDuration behaviour
$ bundle exec rails console
2.1.2 (main):0 > now = Time.now; now - 1.minute == now - Integer(1.minute)
=> true
2.1.2 (main):0 > now = Time.now; now - 1.month == now - Integer(1.month)
=> false # WTF!
2.1.2 (main):0 > 1.month == Integer(1.month)
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment