This project is archived and is in readonly mode.

#6370 ✓resolved
Brian Morearty

Fix for code sample in comment

Reported by Brian Morearty | February 4th, 2011 @ 04:46 AM


This is just a small update to the docs for

Even though 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

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=""></a>