Skip to content

Instantly share code, notes, and snippets.

@vinibaggio
Created April 5, 2011 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinibaggio/902906 to your computer and use it in GitHub Desktop.
Save vinibaggio/902906 to your computer and use it in GitHub Desktop.
Fixture weird behavior
# fixtures/organizations.yml
my_organization:
name: My Organization
subdomain: myorganization
# spec
organization = organizations(:my_organization)
Factory(:site, :organization => organization)
#
# => FAILS:
# ActiveRecord::AssociationTypeMismatch:
# Organization(#2204084900) expected, got Organization(#2203981240)
#
# Debugging, i found out that:
# (rdb:1) organization
# => #<Organization id: 958087004, name: "My Organization", subdomain: "myorganization", owner_id: nil, created_at: "2011-04-05 02:18:32", updated_at: "2011-04-05 02:18:32">
# (rdb:1) organization.is_a? Organization
# => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment