Chris
2009-Feb-02 03:47 UTC
looking for help with NoMethodError: undefined method `key?'' for #<String:0x4795488>
Hi all, Any help with this would be appreciated. I''m using instant rails, updated to 2.2.2, on Windows XP. I''ve created my DB and scaffolded a few things and put some fixtures into place, and when I run the tests I get many errors that look like this: --------------------------------- 1) Error: test_the_truth(EntityTest): NoMethodError: undefined method `key?'' for #<String:0x4795488> C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:584:in `insert_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:583:in `each'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:583:in `insert_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:577:in `each'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:577:in `insert_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:520:in `create_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:520:in `each'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:520:in `create_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 66:in `transaction'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:518:in `create_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/connection_adapters/mysql_adapter.rb:254:in `disable_referential_integrity'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:509:in `create_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/base.rb:1398:in `silence'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:508:in `create_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:964:in `load_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/ active_record/fixtures.rb:930:in `setup_fixtures'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:178:in `send'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:178:in `evaluate_method'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:166:in `call'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:90:in `run'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:90:in `each'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:90:in `send'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:90:in `run'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/callbacks.rb:277:in `run_callbacks'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/ lib/active_support/testing/setup_and_teardown.rb:58:in `run'' --------------------------------- My entity model is dead simple at the moment- class Entity < ActiveRecord::Base end My DB table (entities) has these fields- id created_at updated_at taxa_order taxa_family taxa_genus taxa_species common_name short_description description it was created using this migration code- create_table :entities do |t| t.timestamps t.column "taxa_order", :string, :limit => 127, :default => "", :null => false t.column "taxa_family", :string, :limit => 127, :default => "", :null => false t.column "taxa_genus", :string, :limit => 127, :default => "", :null => false t.column "taxa_species", :string, :limit => 127, :default => "", :null => false t.column "common_name", :string, :limit => 127, :default => "", :null => false t.column "short_description", :string, :limit => 255, :default => "", :null => false t.column "description", :text, :default => "", :null => false end add_index "entities", ["taxa_order"], :name => "taxa_order" add_index "entities", ["taxa_family"], :name => "taxa_family" add_index "entities", ["taxa_genus"], :name => "taxa_genus" add_index "entities", ["taxa_species"], :name => "taxa_species" add_index "entities", ["common_name"], :name => "common_name" and my entities.yml fixture file looks like this- one: taxa_order:testorder taxa_family:testfamily taxa_genus:testgenus taxa_species:testspecies common_name:testcommonname short_description:this is a short description description:this is a longer description, it just goes on and on and on and on and on and on and on and on and on and on and on and on and on and on I suspect the error has something to do with the timestamp stuff (fixtures.rb:584 seems to refer to time stamp fields), but I have no idea what exactly is causing the problem, nor how to go about fixing it. Anyone have any ideas? Thanks! -Chris Warren --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Feb-02 12:46 UTC
Re: looking for help with NoMethodError: undefined method `key?'' for #<String:0x4795488>
On 2 Feb 2009, at 03:47, Chris wrote:> > Hi all, > > Any help with this would be appreciated. I''m using instant rails, > updated to 2.2.2, on Windows XP. > > I''ve created my DB and scaffolded a few things and put some fixtures > into place, and when I run the tests I get many errors that look like > this:i''d guess it''s one of your fixtures (the yml files) that isn''t indented properly Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Warren
2009-Feb-03 01:35 UTC
Re: looking for help with NoMethodError: undefined method `key?'' for #<String:0x4795488>
Thanks! Turned out not to be indenting, but that was the clue I needed to take a closer look at my fixture syntax. I''d accidentally removed the space after the : in name value pairs in one of my files. I hadn''t realized how format sensitive yaml is. Now on to the fun stuff... -Chris On Mon, Feb 2, 2009 at 7:46 AM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 2 Feb 2009, at 03:47, Chris wrote: > >> >> Hi all, >> >> Any help with this would be appreciated. I''m using instant rails, >> updated to 2.2.2, on Windows XP. >> >> I''ve created my DB and scaffolded a few things and put some fixtures >> into place, and when I run the tests I get many errors that look like >> this: > > i''d guess it''s one of your fixtures (the yml files) that isn''t > indented properly > > Fred > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---