# Fixtures load inconsistently

**URL:** <https://www.ruby-forum.com/t/fixtures-load-inconsistently/159915>\
**Category:** Rails\
**Created:** [February 10, 2009, 1:03am UTC](https://www.ruby-forum.com/t/fixtures-load-inconsistently/159915 "2009-02-10T01:03:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bcm](https://www.ruby-forum.com/u/bcm)\
**Post date:** [February 10, 2009, 1:03am UTC](https://www.ruby-forum.com/t/fixtures-load-inconsistently/159915/1 "2009-02-10T01:03:06Z")

</div>

Hi all,

I’ve got a weird problem with loading fixtures, and I’m hoping someone  
out there can help. I’m having problems running my tests, because for  
one of my models the fixtures are loading strangely. Here’s an  
example fixture:

john\_doe:  
status: student  
department:  
alumni:  
title:  
applicant:  
student\_status:  
staff:  
pref\_first\_name:  
faculty:  
applicant\_status:  
year\_in\_school: freshman  
chair:  
pidm: 12345678  
reed\_id: L12345  
program:  
middle\_initial:  
first\_name: John  
student: Y  
login: doej  
last\_name: Doe  
email: removed\_email\_address@domain.invalid

This is a model that’s wrapping a legacy table. It has no id column.  
However, its pidm column is the primary key, so in my model I’ve got:

set\_primary\_key :pidm  
alias\_attribute :id, :pidm

If I load up my fixtures using “rake:fixtures:load RAILS\_ENV=test”  
then everything works just fine. My 5 fixtures for this model go in  
to the test db exactly as written. However, when I run my test suite,  
and rails loads the fixtures, 3 of the 5 fixtures load up with their  
pidm field set to 91.

It’s surprising because it’s only 3 of the 5. I’ve been poking at it  
all morning, with no luck. I’ve changed data values, etc., and it’s  
always the same 3 that come out with 91. The other 2 fixtures have  
the pidm that’s set in the fixture’s yaml file.

Has anybody encountered this? Or does anybody have suggestions?

Thanks!
