ActiveRecord::StatementInvalid could not find table

Hi,

Have searched and searched the group and the net with no joy on this...

I have set up users table and am trying to insert newly registered users with the following code from:

class UserController < ApplicationController

  def index   end

  def register     @title = "Register"     if request.post?       #raise params[:user].inspect       @user = User.new(params[:user])       if @user.save         render :text => "User created!"       end     end   end end

I receive the following error:

ActiveRecord::StatementInvalid in UserController#register

Could not find table 'users' RAILS_ROOT: /Users/Will/Development/rails_space

Application Trace | Framework Trace | Full Trace /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ connection_adapters/sqlite3_adapter.rb:29:in `table_structure' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ core_ext/object/misc.rb:39:in `returning' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ connection_adapters/sqlite3_adapter.rb:28:in `table_structure' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ connection_adapters/sqlite_adapter.rb:213:in `columns' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:1276:in `columns' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:3008:in `attributes_from_column_definition_without_lock' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ locking/optimistic.rb:66:in `attributes_from_column_definition' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:2435:in `initialize' /Users/Will/Development/rails_space/app/controllers/user_controller.rb: 10:in `new' /Users/Will/Development/rails_space/app/controllers/user_controller.rb: 10:in `register' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:1322:in `send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:1322:in `perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ filters.rb:617:in `call_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ filters.rb:610:in `perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ core_ext/benchmark.rb:10:in `realtime' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/ core_ext/benchmark.rb:17:in `ms' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ rescue.rb:160:in `perform_action_without_flash' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ flash.rb:141:in `perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:523:in `send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:523:in `process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ filters.rb:606:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:391:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ base.rb:386:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.2/lib/action_controller/ routing/route_set.rb:433:in `call'

It looks as if Rails is trying to find that table using the sqlite3 adapter, bt my db is configured to use mysql. Here is database.yml:

# MySQL. Versions 4.1 and 5.0 are recommended.

I'm not sure how it's possible to have a different database adapter called up in the script/console from the one you get through script/ server since both paths use the same database.yml file. One way to confirm what you are running in each case is:

Both methods start with you in your project directory. Do not change any files between runs.