title: Could not find table 'users'
body: <p><strong>UPDATE 4</strong> </p>
  
  <p>See solution below!</p>
  
  <p>**Update 3 **</p>
  
  <p>If anyone is actually still reading this (I appreciate it!) I've been struggling around my code today (yes still a noob and in chapter 11 of the ruby on rails tutorial).</p>
  
  <p>I've supposedly reset back to my last commit:</p>
  
  <pre><code>$ cd rails_screencast/sample_app/
  $ git reset --hard 2396c0d288d132ffc43c82d5cbbc736a5258eed2
  HEAD is now at 2396c0d Micropost Validations
  </code></pre>
  
  <p>When I check the site on local host it actually shows a list of users and not an ERROR page but when I run the test suite (autotest with spork - I've reset those a few times too to be sure) I still get all errors such as these shown below. I'm very curious about the "Could not find table 'users'" as it is in EVERY error #</p>
  
  <pre><code>  108) Users signin success should sign a user in and out
       Failure/Error: user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/requests/users_spec.rb:56:in `block (4 levels) in &lt;top (required)&gt;'
  
  Finished in 0.9872 seconds
  108 examples, 108 failures
  </code></pre>
  
  <p>Time to keep on plugging and looking at all these errors, if anyone can offer any insight or hints or ideas what to check I would appreciate it! Or if you need additional information I can post that too (just be very specific to which files to see as I'm not totally fluent in the lingo as many are already)</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>It seems that my reset messed something up with the factory settings as sometimes all my errors are pointing to line 5 of my micropost_spec.rb file specifically @ the @user = Factory(:user) line...  almost like my factories file isn't linked to anything any more. I am wondering if a rake db:migrate would solve any of my problems... or just create new problems... I only have sample data filling in with faker</p>
  
  <p>Any ideas?</p>
  
  <p>Is it possible to revert my file system back to a previous commit and start over? ... when I was green</p>
  
  <pre><code>Failures:
  
    1) Micropost should create a new instance with valid attributes
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  
    2) Micropost user associations should have a user attribute
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  
    3) Micropost user associations should have the right associated user
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  
    4) Micropost validations should have a user id
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  
    5) Micropost validations should require nonblank content
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  
    6) Micropost validations should reject long content
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p><strong>Update 1:</strong></p>
  
  <p>I'm getting errors from 4 to 6 to 111 all with a recurring theme of</p>
  
  <pre><code> 1) Micropost should create a new instance with valid attributes
       Failure/Error: @user = Factory(:user)
       ActiveRecord::StatementInvalid:
         Could not find table 'users'
       # ./spec/models/micropost_spec.rb:53:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Specifically the "Could not find table 'users'" - I copied the code from the tutorial git for the micropost_spec.rb file but didn't seem to fix it- maybe someone can help direct me to what the table is referring to?</p>
  
  <p>////////////////////////////////////// ORIGINAL BELOW ////////////////////////////////</p>
  
  <p>I am working in the Ruby on Rails Tutorial lesson 11 and am trying to populate my db to show the microposts </p>
  
  <p>when I did the rake db:populate command it gave me the following:</p>
  
  <pre><code>    macbook:sample_app macbook$ rake db:populate
  (in /Users/macbook/rails_screencast/sample_app)
  db/test.sqlite3 already exists
  db/test.sqlite3 already exists
  db/development.sqlite3 already exists
  -- create_table("microposts", {:force=&gt;true})
     -&gt; 0.0090s
  -- add_index("microposts", ["user_id"], {:name=&gt;"index_microposts_on_user_id"})
     -&gt; 0.0074s
  -- create_table("users", {:force=&gt;true})
     -&gt; 0.0243s
  -- add_index("users", ["email"], {:name=&gt;"index_users_on_email", :unique=&gt;true})
     -&gt; 0.0094s
  -- initialize_schema_migrations_table()
     -&gt; 0.0167s
  -- assume_migrated_upto_version(20110614132314, "db/migrate")
     -&gt; 0.0432s
  rake aborted!
  Validation failed: Email is invalid
  </code></pre>
  
  <p>I ran it a couple times and kept getting the same error... when I visited the site on a browser it was like none of my sample users were there...</p>
  
  <pre><code>require 'faker'
  
  
  namespace :db do 
    desc "Fill database with sample data"
    task :populate =&gt; :environment do
      Rake::Task['db:reset'].invoke
      admin = User.create!(:name =&gt; "Foo Bar",
                           :email =&gt; "foo@bar.com",
                           :password =&gt; "foobar",
                           :password_confirmation =&gt; "foobar")
     admin.toggle!(:admin)
      99.times do |n|
        name = Faker::Name.name
        email = "example-#{n+1}@railstutorial.org"
        password = "password"
        User.create!(:name =&gt; name,
                     :email =&gt; email,
                     :password =&gt; password,
                     :password_confirmation =&gt; password)
      end
  
      User.all(:limit =&gt; 6).each do |user|
        50.times do
          user.microposts.create!(:content =&gt; Faker::Lorem.sentence(5))
        end
      end
    end
  end
  </code></pre>
  
  <p>then I decided oh maybe rake db:reset will purge my sample database and I can run the populate again with fresh stuff... bad assumption</p>
  
  <p>my test suite now shows:</p>
  
  <pre><code>Finished in 0.99915 seconds
  111 examples, 111 failures
  </code></pre>
  
  <p>Now before I mess more stuff up I'm looking for some advice where to go next ...</p>