akkdio
2011-Jun-08 13:59 UTC
NoMethodError: undefined method `key?'' for "product :ruby cart :one":String
Hi, I am going through the Agile web development with rails 4th edition and am getting this error. It seems to be related to the fixtures (my guess) and all the tests are failing. Can someone point me in the right direction to understand what I did wrong here? Here is the first failure in the test:unit (they all fail) 1) Error: test_the_truth(CartTest): NoMethodError: undefined method `key?'' for "product :ruby cart :one":String /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:589:in `block (2 levels) in insert_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:588:in `each'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:588:in `block in insert_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:582:in `each'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:582:in `insert_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `block (4 levels) in create_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `each'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/connection_adapters/abstract/database_statements.rb: 139:in `transaction'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/connection_adapters/abstract_adapter.rb:109:in `disable_referential_integrity'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:515:in `block in create_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/benchmarkable.rb:55:in `silence'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:514:in `create_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:973:in `load_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ lib/active_record/fixtures.rb:938:in `setup_fixtures'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/callbacks.rb:415:in `_run_setup_callbacks'' /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ lib/active_support/testing/setup_and_teardown.rb:34:in `run'' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Jun-08 16:41 UTC
Re: NoMethodError: undefined method `key?'' for "product :ruby cart :one":String
On 8 June 2011 14:59, akkdio <akkdio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I am going through the Agile web development with rails 4th edition > and am getting this error. It seems to be related to the fixtures (my > guess) and all the tests are failing. Can someone point me in the > right direction to understand what I did wrong here? Here is the > first failure in the test:unit (they all fail) > > > > 1) Error: > test_the_truth(CartTest): > NoMethodError: undefined method `key?'' for "product :ruby > cart :one":StringI don''t know the answer, but in your situation I would start by moving away all my fixtures files. If that removes this problem (your tests will then fail as there is no data of course) put them back until you find the one that is causing the problem (if in fact it is one of the fixtures files). Colin> /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:589:in `block (2 levels) in > insert_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:588:in `each'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:588:in `block in insert_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:582:in `each'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:582:in `insert_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:526:in `block (4 levels) in > create_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:526:in `each'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:526:in `block (3 levels) in > create_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/connection_adapters/abstract/database_statements.rb: > 139:in `transaction'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:524:in `block (2 levels) in > create_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/connection_adapters/abstract_adapter.rb:109:in > `disable_referential_integrity'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:515:in `block in create_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ > lib/active_support/benchmarkable.rb:55:in `silence'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:514:in `create_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:973:in `load_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/ > lib/active_record/fixtures.rb:938:in `setup_fixtures'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ > lib/active_support/callbacks.rb:415:in `_run_setup_callbacks'' > /Users/akkdio/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/ > lib/active_support/testing/setup_and_teardown.rb:34:in `run'' > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.