Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4609310
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:58:08+00:00 2026-05-22T00:58:08+00:00

I am getting a very strange error when running a spec: Failure/Error: entity =

  • 0

I am getting a very strange error when running a spec:

Failure/Error: entity = Factory.create(:entity, :name => "Test Entity", :creator => user)
 ActiveRecord::AssociationTypeMismatch:
   ::User(#97318850) expected, got User(#92770800)

This is the code that results in the above error. Factory is a factory_girl factory.

  user = Factory(:user, :username => "kai", :email => "xxx@yyy.com", :password => "testing")
  entity = Factory.create(:entity, :name => "Test Entity", :creator => user)

When I use :creator => User.first then everything works as expected. I printed out User.first and user, but see no difference.

Any suggestions what the heck is wrong here?

Update

I also got this error when running this simple request spec

describe "Entities" do
  it "should succeed" do
    entity = Factory.create(:entity, :name => "Test Entity 1")
    visit root_path
  end

  it "should also succeed" do
    entity = Factory.create(:entity, :name => "Test Entity 2")
    property = Factory.create(:property, :entity => entity)
  end
end

This time I get

Failure/Error: property = Factory.create(:property, :entity => entity)
 ActiveRecord::AssociationTypeMismatch:
   Entity(#103620190) expected, got Entity(#96047070)

when I delete visit root_path 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.

What does this number behind the class name mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:58:08+00:00Added an answer on May 22, 2026 at 12:58 am

    This is an error that occurs when two different versions of the model have been loaded. I used to hit it in an older version of Rails 3, since the development environment’s model reloader was slightly glitched. The numbers after the class name refer to different versions of the class.

    It stands to reason that this sort of error might come up in development mode, but it shouldn’t in test mode, because, by default, classes are cached. See the config/environments/test.rb file to ensure that cache_classes is set to true.

    Also check that you’re on the latest version of Rails, 3.0.7. This may be a bug that has since been fixed. While we’re at it, check that you’re on factory_girl 1.3.3. When using the API totally correctly, which I think you’re doing, the only possibilities left are that something is misconfigured or that it’s a bug in someone else’s code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a very strange error message when I try to iterate through an
I am getting a very strange error message at one of our client sites
Using the standard add record code I am getting a very strange error when
Hello all I'm getting this very strange error: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lor g/hibernate/classic/Session; at org.cometd.hibernate.util.HibernateUtil.getSessionFactory(HibernateUt il.java:29)
I am getting a very strange error on one of my Silverlight 4.0 pages.
I'm running testunit (with machinist) and getting this very strange result when I run
I'm using Kohana 3.1 and I'm getting a very strange error. The Kohana POST
I am getting a very non specific error when trying to connect to SQL
I am getting this error but only very occasionally. 99.9% of the time it
I'm getting this worthless error in my code. it's very consistant and restarting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.