# Problem with relation ship using fixtures

**URL:** <https://www.ruby-forum.com/t/problem-with-relation-ship-using-fixtures/157121>\
**Category:** Rails\
**Created:** [January 7, 2009, 3:16pm UTC](https://www.ruby-forum.com/t/problem-with-relation-ship-using-fixtures/157121 "2009-01-07T15:16:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naga\_harish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90ced4/32.png) [@Naga\_harish\_K](https://www.ruby-forum.com/u/Naga_harish_K)\
**Post date:** [January 7, 2009, 3:16pm UTC](https://www.ruby-forum.com/t/problem-with-relation-ship-using-fixtures/157121/1 "2009-01-07T15:16:17Z")

</div>

Hi all,  
I am having a problem with the relation ship with the fixtures.

My rails version is 2.2.2, and am using the old style of fixtures.

My models are

Class Account \< ActiveRecord::Base  
has\_many :users  
end

Class User \< ActiveRecord::Base  
belongs\_to :account  
end

My Fixtures are

#users.yml  
Harish:  
id: 1  
name: Harish  
account\_id: 1  
Rahul:  
id: 2  
name: Rahul  
account\_id: 1

#accounts.yml  
account1:  
id: 1  
name: Account1

so in my model code if I have  
1 user = User.find(user\_id)  
2 user.account.name

Then its giving NoMethodError in Line #2  
when I try user.account its giving # class but  
user.account.name is failing.

I also tried with the new fixtures as per Rails 2.0 still same problem.  
What I might be missing?  
Any thing should be loaded??  
This code is working in Rails 1.2.3 previously, but now its not  
working…  
Can any one help with this??
