# Problem Referencing Fixture Objects

**URL:** <https://www.ruby-forum.com/t/problem-referencing-fixture-objects/54156>\
**Category:** Rails\
**Created:** [February 24, 2006, 5:02pm UTC](https://www.ruby-forum.com/t/problem-referencing-fixture-objects/54156 "2006-02-24T17:02:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [February 24, 2006, 5:02pm UTC](https://www.ruby-forum.com/t/problem-referencing-fixture-objects/54156/1 "2006-02-24T17:02:00Z")

</div>

In my tests, I use fixtures, eg pupils.yml might be:

jimmy:  
id: 100003  
known\_as: Jimmy  
surname: Page  
academic\_year\_id: 1  
gender: m

In the test, @jimmy (the referencing style referred to in Agile Web  
Dev…)  
is nil, whereas pupil(:jimmy) returns the expected Pupil object.

What gives?

Robert

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [February 24, 2006, 5:11pm UTC](https://www.ruby-forum.com/t/problem-referencing-fixture-objects/54156/2 "2006-02-24T17:11:10Z")

</div>

Robert J. wrote:

> is nil, whereas pupil(:jimmy) returns the expected Pupil object.
> 
> What gives?

A change in syntax between the book’s publication and Rails 1.0. You  
can turn the ols style back on, but unless you’ve got old, failing  
tests, there’s really not much reason.

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [February 24, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/problem-referencing-fixture-objects/54156/3 "2006-02-24T17:33:19Z")

</div>

Alex Y. wrote:

> > In the test, @jimmy (the referencing style referred to in Agile Web  
> > Dev…) is nil, whereas pupil(:jimmy) returns the expected Pupil object.
> > 
> > What gives?
> 
> A change in syntax between the book’s publication and Rails 1.0. You  
> can turn the ols style back on, but unless you’ve got old, failing  
> tests, there’s really not much reason.

Thanks - I thought I was going nuts!

Robert
