title: Example of something that is not thread-safe in Rails
body: <p>I've seen threads like <a href="https://stackoverflow.com/questions/15184338/how-to-know-what-is-not-thread-safe-in-ruby">this</a> on thread-safety in Rails and various web pages on the topic, and I'm sure everyone's great at reciting what it is and giving 'tips' on what isn't thread-safe ("class variables!"), but I can never seem to find a clear, simple, complete example of something that is actually not thread-safe <em>in Rails</em>, to the point where I wonder if anyone actually understands it at all.</p>
  
  <p>I would be grateful if someone could prove me wrong and give:</p>
  
  <ul>
  <li><p>a clear, simple, complete example of something that is not thread-safe in Rails.  It should be clear where the code is (i.e., if it is in the controller, please show it as such) and nothing should be left to the reader's imagination (such as a method that doesn't exist).  Also, there shouldn't be any superfluous code or logic.</p></li>
  <li><p>exactly how it would be problematic in the context of two users connecting to the website at the same time, on two different threads.</p></li>
  <li><p>how to rectify the problem.</p></li>
  </ul>
  
  <p>The more significant and Rails-relevant the example, the better, so if you can give an example where one user might see another user's data (or similar), please do so.</p>