Fix error due to #10686

wants to merge 1 commit into


None yet
5 participants

vipulnsward commented May 19, 2013

In changes to fix now requires an object to implement to_int. Aliasing to_int to to_i fixes this.

In changes to fix "" 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.

aselder commented May 24, 2013


Also a big +1 to backport to 3.2-branch.


pixeltrix commented May 25, 2013

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.

@ghost ghost assigned pixeltrix May 25, 2013


pixeltrix commented May 25, 2013

Ugh, it looks as though 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 to convert TWZ values first before calling super.


vipulnsward commented May 25, 2013

@pixeltrix Right. ruby/ruby@c64f26a had motivated me to make this small fix. There should be a better approach. I hope overriding 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.


pixeltrix commented Jun 8, 2013

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

@pixeltrix pixeltrix closed this Jun 8, 2013


vipulnsward commented Jun 12, 2013

Thanks @pixeltrix !

@vipulnsward vipulnsward deleted the vipulnsward:fix_time_at branch Jun 12, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment