I’ve been doing a major refactor that required several migrations. All of a sudden, rspec is failing.
Could not find table 'users' (ActiveRecord::StatementInvalid)
The users table is right there in schema.rb:
create_table "users", :primary_key => "user_id", :force => true do |t|
t.string "first_name", :limit => 100, :null => false
t.string "last_name", :limit => 100, :null => false
(...)
t.boolean "current_student", :default => true, :null => false
t.boolean "unregistered", :default => false, :null => false
end
Here’s what I’ve tried:
rake db:test:prepare: No change- removing
schema.rband recreating it withrake db:schema:dump: No change
My app is working fine – I can create users, log in, log out, etcetera. But none of my tests work. What should I try next?
Found the issue.
In one of my models, I had a scope written thus:
Deep in the stack trace, there was actually a reference to this line. I changed the scope to:
…and everything worked. Whew.