John-Mason P. Shackelford
2004-Dec-09 07:42 UTC
fixture problem, TypeError: nil is not a symbol
When I run rake against Rails 8.5 to test unaltered model tests with yaml fixtures I get the error and stack trace reproduced below for every one of my model objects. Has anyone seen something this before? Any idea what could be going on here? The following ruby-talk thread may or may not be relevant: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/95301. Thanks much, John-Mason Sample Stack Trace: --------------------------------------- 1) Error: test_truth(ArtifactTest): TypeError: nil is not a symbol ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:168:in `const_get'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:168:in `find'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:78:in `instantiate_fixtures'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:78:in `each'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:78:in `instantiate_fixtures'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:76:in `each_with_index'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:76:in `each'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:76:in `each_with_index'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:76:in `instantiate_fixtures'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:249:in `instantiate_fixtures'' ./test/unit/../../config/environments/../../vendor/activerecord/lib/active_record/fixtures.rb:234:in `setup'' Sample Test: --------------------------------------- require File.dirname(__FILE__) + ''/../test_helper'' require ''team'' class TeamTest < Test::Unit::TestCase fixtures :teams # Replace this with your real tests def test_truth assert true end end Sample YAML fixture: --------------------------------------- name: one data: id: 1 name: ePen Sample model: --------------------------------------- require ''active_record'' class Team < ActiveRecord::Base has_many :products, :dependent => true end
David Heinemeier Hansson
2004-Dec-09 09:50 UTC
Re: fixture problem, TypeError: nil is not a symbol
> When I run rake against Rails 8.5 to test unaltered model tests with > yaml fixtures I get the error and stack trace reproduced below for > every one of my model objects. Has anyone seen something this before? > Any idea what could be going on here?It looks like you''re using the beta gems with the old yaml format? You can read about the new format on: http://dev.rubyonrails.org/trac.cgi/file/trunk/activerecord/lib/ active_record/fixtures.rb -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain
John-Mason P. Shackelford
2004-Dec-09 18:36 UTC
Re: fixture problem, TypeError: nil is not a symbol
David, Thanks for the tip. I''ll try this new format. > It looks like you''re using the beta gems with the old yaml format? Actually I am running 0.8.5; just did the download again and a diff to make sure. I also looked at trac, as you suggested and the version of fixtures.rb that shipped with 0.8.5 is not any of the revisions listed there--and its comments do not mention a the new format. Is this because 0.8.5 was released out of CVS? John-Mason