I'm trying to build a Rails app around a pre-existing MySQL database. I created the rails project, set up the database.yml file properly and created one model, User, to correspond to my users table in the db. When I run the rails console to test it out however, this is what I get:
> User.all
(32.4ms) SHOW TABLES
(34.9ms) describe `users`
NoMethodError: undefined method `accept' for nil:NilClass
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_all'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/querying.rb:38:in `block in find_by_sql'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/explain.rb:40:in `logging_query_plan'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/querying.rb:37:in `find_by_sql'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/relation.rb:170:in `exec_queries'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/relation.rb:159:in `block in to_a'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/explain.rb:33:in `logging_query_plan'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/relation.rb:158:in `to_a'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/relation/finder_methods.rb:159:in `all'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/querying.rb:5:in `all'
from (irb):1
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
from /home/richard/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3-p0 :002 > ^C
Any idea why this might be? I'm following the rails convention as far as I'm aware: I made a User model to correspond with a table called users already in the db, whose primary key is an integer field called id.