# Problems with testing, foxy fixtures and polymorphism

**URL:** <https://www.ruby-forum.com/t/problems-with-testing-foxy-fixtures-and-polymorphism/173843>\
**Category:** Rails\
**Created:** [August 16, 2009, 5:13pm UTC](https://www.ruby-forum.com/t/problems-with-testing-foxy-fixtures-and-polymorphism/173843 "2009-08-16T17:13:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kinunt](https://www.ruby-forum.com/u/kinunt)\
**Post date:** [August 16, 2009, 5:13pm UTC](https://www.ruby-forum.com/t/problems-with-testing-foxy-fixtures-and-polymorphism/173843/1 "2009-08-16T17:13:49Z")

</div>

Hi,

I’m using Rails version 2.3.2 but it seems that my fixtures are wrong  
and when testing a relation among two models does not appear. I have no  
problems executing the application, only with tests.

These are my fixtures:

/\*\*\*\*\* ingresos.yml \*\*\*\*\*/  
primero:  
origen: jack (Cliente)  
tipo: Banco  
fecha: 2009-06-05  
cantidad: 10

/\*\*\*\*\* clientes.yml \*\*\*\*\*/  
jack:  
nombre: Jack Sephard

The error (The error ocurred while evaluating nil.nombre) is in this  
line:

/\*\*\*\*\* show.html.erb \*\*\*\*\*/  
\<%=h @ingreso.origen\_type %\>: \<%= @ingreso.origen.nombre %\>

The models are these:

/\*\*\*\*\* ingreso.rb \*\*\*\*\*/  
class Ingreso \< ActiveRecord::Base  
belongs\_to :origen, :polymorphic =\> true

/\*\*\*\*\* cliente.rb \*\*\*\*\*/  
class Cliente \< ActiveRecord::Base  
has\_many :ingresos, :as =\> :origen  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

Any idea will be appreciated. Thanks in advance.
