This project is archived and is in readonly mode.
Fix for code sample in Time.zone= comment
Reported by Brian Morearty | February 4th, 2011 @ 04:46 AM
Hi,
This is just a small update to the docs for Time.zone=.
Even though Time.zone is thread-local, it will leak across requests within the same thread if you handle one request with a logged-in user and the next request with a logged-out user.
This little change updates the sample code to use an around_filter instead of a before_filter to show how to fix this.
P.S. You might be tempted to combine the first two lines of set_time_zone into one line with the comma assignment syntax and add "if logged_in? to the one line in the ensure clause. Don't do it. If you did that, the user's time zone would leak out to the next request when the user logs out.
Comments and changes to this ticket
-
Brian Morearty February 4th, 2011 @ 04:48 AM
- Tag changed from documentation, timezone to doc, documentation, timezone
-
Santiago Pastorino February 4th, 2011 @ 01:31 PM
- State changed from new to resolved
- Importance changed from to Low
Hey Brian do you mind to go ahead and just push your changes to http://github.com/lifo/docrails this repo has free access to push and is the official way for docs :).
-
Brian Morearty February 4th, 2011 @ 05:20 PM
Thanks, Santiago. I missed the little note about how to push doc changes at the end of the contributor guide.
I've made the doc patch in docrails.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>