Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeZone requires preloading before #freeze #1977

Closed
wants to merge 2 commits into from
Closed

TimeZone requires preloading before #freeze #1977

wants to merge 2 commits into from

Conversation

jfelchner
Copy link

'Can't modify frozen object' when calling #freeze after instantiation

Although I did add tests to this which should have failed, for some reason they didn't. If someone with more knowledge of Rails dependencies could help me out I would appreciate it.

The issue this fixes is here: #1966

There is a 100% repeatable (on the 3 MacBooks I tried) bug wherein executing the following:

rails new foo
cd foo
bundle install
rails console

And within IRB:

ActiveSupport::TimeZone.new('Alaska').freeze

Raises a Can't modify a frozen object RuntimeError.

Although I can get this error to occur every time, I cannot get it to be reproduced in a test.

I hope this at least puts everyone on the right track to tracking down this problem.

@@ -289,6 +289,12 @@ module ActiveSupport
Time.now.utc.in_time_zone(self)
end

# Preload information prior to freezing
def freeze
tzinfo; utc_offset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better split this line into two, and get rid of the semicolons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm agree. Can you amend your patch and force-push to your branch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry guys, was on vacation. I can certainly do that. I'll get it in today.

'Can't modify frozen object' when calling #freeze after instantiation
@jfelchner
Copy link
Author

@sikachu Sorry for the delay. Hope this meets your approval. Thanks again for taking a look at this!

@akaspick
Copy link
Contributor

+1

@arunagw
Copy link
Member

arunagw commented Jan 8, 2012

Not sure about the orignal issue. But what's going on about this PR?

@isaacsanders
Copy link
Contributor

Is this still an issue?

@jfelchner
Copy link
Author

This was previously an issue for me but I haven't been hacking on timezones in a while.

I just tried it again and cannot reproduce. I'll close it for now.

@jfelchner jfelchner closed this May 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants