title: Undefined method 'accept' for nil:NilClass after upgrading to Rails 3
body: <p>I just upgraded my Rails application from Rails 2.3.8 to Rails 3.2.7 and I've run across a problem with Activerecord.</p>
  
  <p>If I try to access my database with Activerecord at all(Ex: Employee.last), I get the following error:</p>
  
  <pre><code>NoMethodError: undefined method `accept' for nil:NilClass
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:38:in `find_by_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/explain.rb:40:in `logging_query_plan'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:37:in `find_by_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:171:in `exec_queries'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:160:in `to_a'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/explain.rb:33:in `logging_query_plan'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:159:in `to_a'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:378:in `find_first'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:122:in `first'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:336:in `find_one'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:107:in `find'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:5:in `__send__'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:5:in `find'
  </code></pre>
  
  <p>I am using Rails 3.2.7 with Ruby 1.8.7.  I was previously using the mysql 2.7 version but was faced with errors when upgrading, so I am now using mysql2 (0.311) as well as  activerecord-myql2-adapter (0.0.3).</p>
  
  <p>The problem seems similar to this:</p>
  
  <p><a href="https://stackoverflow.com/questions/9296444/rails-3-model-all-nomethoderror-undefined-method-accept-for-nilnilclass">Rails 3: Model.all =&gt; NoMethodError: undefined method &#39;accept&#39; for nil:NilClass</a></p>
  
  <p>But I tried all the solutions presented there and none of them worked.</p>
  
  <p>EDIT:
  If I take out the 'activerecord-mysql2-adapter' gem, I get the following error instead.</p>
  
  <pre><code>Address Load (0.7ms)  SELECT `addresses`.* FROM `addresses` LIMIT 1
  NoMethodError: undefined method `generated_methods?' for #&lt;Class:0x7f10733eb2e8&gt;
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in `method_missing'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/markos_validates_timeliness-2.3.2.2/lib/validates_timeliness/active_record/attribute_methods.rb:46:in `define_attribute_methods'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/attribute_methods.rb:168:in `respond_to?'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activesupport-3.2.7/lib/active_support/callbacks.rb:398:in `__run_callback'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activesupport-3.2.7/lib/active_support/callbacks.rb:385:in `_run_find_callbacks'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activesupport-3.2.7/lib/active_support/callbacks.rb:81:in `send'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activesupport-3.2.7/lib/active_support/callbacks.rb:81:in `run_callbacks'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/base.rb:523:in `init_with'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/inheritance.rb:68:in `instantiate'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:38:in `find_by_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:38:in `collect!'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:38:in `find_by_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/explain.rb:40:in `logging_query_plan'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:37:in `find_by_sql'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:171:in `exec_queries'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:160:in `to_a'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/explain.rb:33:in `logging_query_plan'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation.rb:159:in `to_a'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:378:in `find_first'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/relation/finder_methods.rb:122:in `first'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:5:in `__send__'
  from /home/aneyer/.rvm/gems/ruby-1.8.7-p370@rails3/gems/activerecord-3.2.7/lib/active_record/querying.rb:5:in `first'
  </code></pre>