Marc Kohlbrugge
2005-Apr-26 19:48 UTC
NoMethodError (undefined method `fetch_fields'' for nil:NilClass)
Hi I''m new to Rails (and Ruby) and I can''t get it to work properly. Every time I want to do something with my database-connection (e.g. use scaffold) I get this, or something similiar (from development.log): >> Beneath this code there''s some more text << ------- Processing CategoryController#index (for 127.0.0.1 at Tue Apr 26 21:43:45 CEST 2005) Parameters: {"action"=>"index", "controller"=>"category"} [4;33mCategory Count (0.001415) [1;37mSELECT COUNT(*) FROM categories NoMethodError (undefined method `fetch_fields'' for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/ active_record/connection_adapters/mysql_adapter.rb:204:in `select'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/ active_record/connection_adapters/mysql_adapter.rb:98:in `select_one'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/ active_record/base.rb:452:in `count_by_sql'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/ active_record/base.rb:445:in `count'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/pagination.rb:154:in `count_collection_for_pagination'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/pagination.rb:171:in `paginator_and_collection_for'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/pagination.rb:111:in `paginate'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/scaffolding.rb:101:in `list'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/scaffolding.rb:94:in `index'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:708:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:708:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/filters.rb:294:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/rescue.rb:79:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:330:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:330:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:273:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/dispatcher.rb:32:in `dispatch'' /Volumes/Documents/home/WebServer/Documents/ToDo/public/ dispatch.cgi:10 Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/templates/rescues/layout.rhtml (500 Internal Error) ------- In the browser the page only displays some error message stuff like "NoMethodError (undefined method `fetch_fields'' for nil:NilClass):". I followed some tutorials and I always got something like this when using scaffold, so it must be my setup. I use Mac OS X. Any help is much appreciated! Kind regards, Marc
Possibly Parallel Threads
- keep getting "undefined method `map' for nil:NilClass (NoMethodError) " in new server
- has_one :through NoMethodError: undefined method `klass' for nil:NilClass when doing class_name on reflection
- Contact form - NoMethodError (undefined method `each' for nil:NilClass)
- Bug: NoMethodError: private method `gsub'' called for nil:NilClass
- NoMethodError: undefined method `accept' for nil:NilClass