title: Strange ActiveRecord::AssociationTypeMismatch
body: <p>I am getting a very strange error when running a spec:</p>
  
  <pre><code>Failure/Error: entity = Factory.create(:entity, :name =&gt; "Test Entity", :creator =&gt; user)
   ActiveRecord::AssociationTypeMismatch:
     ::User(#97318850) expected, got User(#92770800)
  </code></pre>
  
  <p>This is the code that results in the above error. Factory is a factory_girl factory.</p>
  
  <pre><code>  user = Factory(:user, :username =&gt; "kai", :email =&gt; "xxx@yyy.com", :password =&gt; "testing")
    entity = Factory.create(:entity, :name =&gt; "Test Entity", :creator =&gt; user)
  </code></pre>
  
  <p>When I use <code>:creator =&gt; User.first</code> then everything works as expected. I printed out <code>User.first</code> and <code>user</code>, but see no difference.</p>
  
  <p>Any suggestions what the heck is wrong here?</p>
  
  <h2>Update</h2>
  
  <p>I also got this error when running this simple request spec</p>
  
  <pre><code>describe "Entities" do
    it "should succeed" do
      entity = Factory.create(:entity, :name =&gt; "Test Entity 1")
      visit root_path
    end
  
    it "should also succeed" do
      entity = Factory.create(:entity, :name =&gt; "Test Entity 2")
      property = Factory.create(:property, :entity =&gt; entity)
    end
  end
  </code></pre>
  
  <p>This time I get</p>
  
  <pre><code>Failure/Error: property = Factory.create(:property, :entity =&gt; entity)
   ActiveRecord::AssociationTypeMismatch:
     Entity(#103620190) expected, got Entity(#96047070)
  </code></pre>
  
  <p>when I delete <code>visit root_path</code> everything works fine (also when running each spec on its own). It just seems to be a problem for request specs. The other specs (model, controller) seems to run fine. I use Capybara 1.0.0.beta1 and RSpec 2.5.</p>
  
  <p>What does this number behind the class name mean?</p>