GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
In changes to fix https://bugs.ruby-lang.org/issues/8173. Time.at now requires an object to implement to_int. Aliasing to_int to to_i fixes this.
In changes to fix https://bugs.ruby-lang.org/issues/8173. "Time.at" n…
…ow requires an object to implement "to_int". Aliasing "to_int" to "to_i" fixes this.
Thanks @vipulnsward ! Will this be backported to all supported Rails versions? 3.2.x at least (3.1.x as well)? As folks update to Ruby 1.9.3-p429, they will encounter this.
Also a big +1 to backport to 3.2-branch.
I'm not sure this is the right fix. The change made to Ruby was to prevent Time objects being treated as integers - this would nullify the effect of the change as AS::TWZ is meant to be compatible with Time. I'll investigate further.
Ugh, it looks as though Time.at checks the type of the first argument to see if it's a Time value and converts it if it does, however the type check explicitly checks that it's not a subclass of Time.
Just blindly adding to_int isn't really the answer as it's saying that TWZ values can be treated like integers all of the time and may have consequences elsewhere. We may have to consider overriding Time.at to convert TWZ values first before calling super.
@pixeltrix Right. ruby/ruby@c64f26a had motivated me to make this small fix. There should be a better approach. I hope overriding Time.at won't add an extra overhead.
Ruby 1.9.3-p429 FAIL
I use Rails 3.2.12. As a quick work around, I went down to p392 patch level, in development, which works if anybody is in a rush to get things working while a solution is in the works:
rvm upgrade 1.9.3-p429 1.9.3-p392
though note that Heroku for example uses p429 in its stack, so you'd be broken if you're using ruby 1.9.3 and Rails 3.2.x in Heroku.
Fixed in master: b7f9de2
Fixed in 4-0-stable: 927df2d
Fixed in 4-0-0: 214e377
Fixed in 3-2-stable: f42e0fd
@vipulnsward thanks for reporting
Thanks @pixeltrix !