I would like to hear ideas about a problem I''m having with testing a controller from a model that uses polimorphism. It seems that the fixture do not recognize the relationship. Did you see errors in these files? The error I get is: /***** ERROR *****/ 1) Error: test_should_show_ingreso(IngresosControllerTest): ActionView::TemplateError: You have a nil object when you didn''t expect it! The error occurred while evaluating nil.nombre On line #18 of app/views/ingresos/show.html.erb 15: 16: <p> 17: <b>Origen</b> 18: <%=h @ingreso.origen_type %>: <%= @ingreso.origen.nombre %> 19: </p> 20: 21: app/views/ingresos/show.html.erb:18 app/controllers/ingresos_controller.rb:86:in `show'' /test/functional/ingresos_controller_test.rb:32:in `test_should_show_ingreso'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'' c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'' c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'' c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'' c:/ruby/lib/ruby/1.8/test/unit.rb:278 rake (0.8.7) lib/rake/rake_test_loader.rb:5 /***** clientes.yml *****/ jack: NIF: B98654321 nombre: Jack /***** ingresos.yml *****/ primero: origen: jack (Cliente) /***** cliente.rb *****/ class Cliente < ActiveRecord::Base has_many :ingresos, :as => :origen end /***** ingreso.rb *****/ class Ingreso < ActiveRecord::Base belongs_to :origen, :polymorphic => true end /***** test_ingresos_controller.rb *****/ test "should show ingreso" do get :show, { :id => ingresos(:primero).to_param }, { :usuario_id => usuarios(:fulanito).id } assert_response :success end /***** views/ingresos/show.html.erb <p> <b>Origen</b> <%=h @ingreso.origen_type %>: <%= @ingreso.origen.nombre %> </p> Any help will be appreciated. Thanks in advance. -- Posted via http://www.ruby-forum.com/.