title: When Ruby on Rails server change to using a DB session store, then users need to "clear the cookies?"
body: <p>Maybe I can summarize the question: If a Rails app goes into Maintenance for 30 minutes and the Rails Session Store is changed from using cookies to using DB, then any user who  has the browser open won't be able to use the Rails apps for any session store capability unless the user clears all the cookies or restart the browser.  Is there a way to fix this behavior (because users who didn't do that will get stuck and possibly frustrated).</p>
  
  <hr>
  
  <p>Details:</p>
  
  <p>To understand Rails' session store better, I created a new project that at first uses cookie as the session store (using Rails 2.3.8 with Ruby 1.8.7)...</p>
  
  <p>and values can be stored in the session.  and then without closing the browser, I stopped the Rails server, removed the <code>#</code> in front of </p>
  
  <pre><code>#ActionController::Base.session_store = :active_record_store
  </code></pre>
  
  <p>and did a <code>rake db:sessions:create</code> and then a <code>rake db:migrate</code> (to create a <code>sessions</code> table in the DB).</p>
  
  <p>But now, my browser was never closed, and when I print out the session variables, it won't work, and when I set some values into the session, using <code>FoosController#show</code>, and print out the session values in <code>FoosController#index</code> (in the view).  Although the values can be set in <code>show</code>, they don't show up in <code>index</code>.  I have to clear out the cookies in my browser (or exit my browser and start it up again, so that the values can be set in <code>show</code> and then <code>index</code> will show it correctly now.</p>
  
  <p>I guess for a thing like changing the session store from cookie to DB, the server will be shut down, meaning the site will be down for a few minutes to a couple of hours... but the users may not close the browser during this time... and </p>
  
  <p>1) any session values that was set previously won't show (probably acceptable)<br>
  2) any new session values set by the server now also will <strong>not</strong> go into the user's session store.</p>
  
  <p>I think (1) above is ok, but (2) can drive the user crazy... keeping on trying for 30 minutes, and wait an hour, or two hours later, still won't work (for example, cannot log in and read a second page as a logged in user, because <code>session[:user_id]</code> cannot be set successfully.  The user will probably call tech support and the tech support may or may not suggest "clearing the cookie"... but is a pretty crude way to fix something.  (or restart the browser will work too... but the user may have so many tabs open that he actually need to go through all the tabs and bookmark anything and then close and restart the browser.)</p>
  
  <p>So it this true for a Rails server?  Or somebody know the newer versions of Rails already fixed that issue?</p>