Missing require breaks Time.=== when selectively loading ActiveSupport core_exts in 3.2.4+ #6857

Merged
merged 1 commit into from Jun 25, 2012

Conversation

Projects
None yet
3 participants
Contributor

rsutphin commented Jun 25, 2012

If you selectively require core_exts (e.g., require 'active_support/core_ext/string'), it is possible for
active_support/core_ext/time/calculations to be required when ActiveSupport::TimeWithZone is not available. If this happens, the next call to Time.=== will fail with a NameError. This pull fixes this issue.

Then nature of this problem is not amenable to unit testing, but I can provide a script which demonstrates the problem.

This bug was introduced in Rails 3.2.4 and is present in 3.2.5, 3.2.6, 3-2-stable, and master.

@rsutphin rsutphin Add missing require.
If you selectively require core_exts (e.g., require
'active_support/core_ext/string'), it is possible for
'active_support/core_ext/time/calculations' to be required when
`ActiveSupport::TimeWithZone` is not available. If this happens, the next call
to Time.=== will fail with a NameError.
e6d4dc3

Looks ok, your script shows the error. Thanks.

carlosantoniodasilva merged commit 07875be into rails:master Jun 25, 2012

Contributor

rsutphin commented Jun 25, 2012

Thanks for applying this so quickly. It would be useful to me if this were in the next 3.2 release (I have library which uses ActiveSupport and which I try to keep working with all 3.x.latest versions). Would it be helpful for me to open another pull request for 3-2-stable?

Thanks again.

Owner

spastorino commented Jun 25, 2012

I've seen this same issue, @carlosantoniodasilva did you backport it? I can do it if you didn't ❤️

I didn't backport because I had a power outage here 2 seconds after I clicked merge :P.. doing it now...

Done 3fccf6a.

@rsutphin I've cherry-picked to 3-2-stable, thanks!

rsutphin deleted the rsutphin:as_core_ext_time_missing_require branch May 30, 2014

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