Created
August 6, 2012 14:32
-
-
Save fredwu/3274847 to your computer and use it in GitHub Desktop.
ruby/rails wtf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby 1.9.3-p194 + rails 3.2.6 | |
Date.new.step(Date.new, 1.second).map{} | |
#=> TypeError: expected numeric | |
Date.new.step(Date.new, 1.second.to_i).map{} | |
#=> [nil] | |
Date.new.step(Date.new, 1).map{} | |
#=> [nil] | |
# ruby 1.9.2-p290 + rails 3.2.6 | |
Date.new.step(Date.new, 1.second).map{} | |
#=> [nil] | |
Date.new.step(Date.new, 1.second.to_i).map{} | |
#=> [nil] | |
Date.new.step(Date.new, 1).map{} | |
#=> [nil] |
Thanks @rkh and @tenderlove!
@tenderlove I've tried your snippet and on both 1.9.2 and 1.9.3, this is the result:
TypeError: no implicit conversion from nil to integer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, yeah, what I said but the other way around: 1.9.2 used to call it, and it was
to_i
, notto_int
.