Im trying to follow the Learn Ruby on Rails tutorial my Michael Hartl. I'm on chapter 7 which grabs user data from a database to display pages. However, I keep getting an error that there is no user with an ID of one. I can't verify the data in the database (since the sql database viewer says it cant open the file and I have no idea how to install the 1.1 version which allegedly fixes that problem).
I tried adding a user in the console and it seems to succeed, but the second I go to find the user I just created, it doesn't exist (see below). Any help? I'm very frustrated at the moment.
User.find
1.9.3-p327 :001 > User.find(1)
User Load (31.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
ActiveRecord::RecordNotFound: Couldn't find User with id=1
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:341:in `find_one'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:107:in `find'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/querying.rb:5:in `find'
from (irb):1
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
User.create
1.9.3-p327 :002 > User.create(name: "MD", email: "md@example.com", password: "foobar", password_confirmation: "foobar")
(22.6ms) SAVEPOINT active_record_1
User Exists (56.7ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('md@example.com') LIMIT 1
SQL (153.7ms) INSERT INTO "users" ("created_at", "email", "name", "password_digest", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", Mon, 11 Feb 2013 00:59:52 UTC +00:00], ["email", "md@example.com"], ["name", "MD"], ["password_digest", "$2a$10$NFEb9PsPQuSEGbJ8.TOILefjZMgTAJXCFHExZpGZmlov72UffjoUe"], ["updated_at", Mon, 11 Feb 2013 00:59:52 UTC +00:00]]
(0.4ms) RELEASE SAVEPOINT active_record_1
=> #<User id: 4, name: "MD", email: "md@example.com", created_at: "2013-02-11 00:59:52", updated_at: "2013-02-11 00:59:52", password_digest: "$2a$10$NFEb9PsPQuSEGbJ8.TOILefjZMgTAJXCFHExZpGZmlov...">
User.find
1.9.3-p327 :003 > User.find(1)
User Load (2.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
ActiveRecord::RecordNotFound: Couldn't find User with id=1
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:341:in `find_one'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:312:in `find_with_ids'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:107:in `find'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.9/lib/active_record/querying.rb:5:in `find'
from (irb):3
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
from /home/gerard/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'