title: Reloading ActiveRecord objects in Rspec (particularly after a POST request)
body: <p>I have a <code>time_zone</code> attribute on my <code>User</code> model which tracks the user's preferred time_zone. This starts off as <code>nil</code> by default.</p>
  
  <p>On their personal EDIT page, the user can change their timezone by selecting another one from a dropdown list.</p>
  
  <p>My test is as follows - </p>
  
  <pre><code>it "updates the user's time zone on submit" do
    # Creates with FactoryGirl
    @user = create(:user)
  
    # BEFORE state confirmation
    expect(@user.time_zone).to be_nil
  
    # Simulate the user selecting a timezone from the dropdown on their edit page. 
    # Capybara is used for selection and clicking.
    visit edit_profile_path
    select_time_zone_from_dropdown("America/New_York")
  
    # Submit, which sends a POST request to update the User model
    click_button("Submit")
  
    # AFTER state confirmation - this FAILS
    # Apparently the reload doesn't work and `time_zone` is still set to
    # nil for this user 
    @user.reload
    expect(@user.time_zone).to eq("America/New_York")
  end
  </code></pre>
  
  <p>As you can see, the test fails because the <code>time_zone</code> is never updated for this User record.</p>
  
  <p>Here's what's strange -</p>
  
  <ol>
  <li><p>In the database, the value correctly DOES change. It's just the <code>ActiveRecord</code> object which doesn't</p></li>
  <li><p>To get around #1, I tried reloading the object attributes, but no luck</p></li>
  <li><p>If I pause it with <code>binding.pry</code> just after the <code>reload</code> and run <code>@user.reload</code> <strong>manually</strong>, it works. So it's just while running during the test suite that it's not working.</p></li>
  </ol>
  
  <p>Is there something strange going on here with how the value is cached and reloaded?</p>
  
  <p>Thanks!</p>