Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Generating User Model Problems/Ruby on Rails

Hey, I'm getting to the point in the video where you are supposed to use the "rake db:migrate" command to create the users table, but I get this message:

-- create_table(:statuses) rake aborted! An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "statuses" already exists: CREATE TABLE "statuses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "content" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) C:/Sites/Projects/treebook/db/migrate/20120718214245_create_statuses.rb:3:in ch ange' C:inmigrate' Tasks: TOP => db:migrate

Any thoughts? I went through the video a few times and I can't find where I deviated. The video said the command was to create the users table but I notice that the message keeps mentioning the statuses table.

3 Answers

I think I got it, I removed the "create statuses" file from the migrate folder and it made the sign up page when I used the rake command. Still slightly off from the example; it may have to do with me using the project files instead of my own.

NoMethodError in Statuses#new

Showing /var/lib/stickshift/51c8b66b5973cac7c2000059/app-root/data/456597/app/views/statuses/_form.html.erb where line #17 raised:

undefined method `content' for #<Status id: nil, created_at: nil, updated_at: nil, user_id: nil> Extracted source (around line #17):

14: <div class="field"> 15:
16: </div> 17: <%= f.input :content %> 18: <div class="actions"> 19: <%= f.submit %> 20: </div> Trace of template inclusion: app/views/statuses/new.html.erb

Rails.root: /var/lib/stickshift/51c8b66b5973cac7c2000059/app-root/data/456597

Application Trace | Framework Trace | Full Trace app/views/statuses/form.html.erb:17:in `block in _app_views_statusesform_html_erb4582378182949388460_70182754197540' app/views/statuses/_form.html.erb:1:in `_app_views_statusesform_html_erb_4582378182949388460_70182754197540' app/views/statuses/new.html.erb:3:in `_app_views_statuses_new_html_erb4366996796839014421_70182754006920' app/controllers/statuses_controller.rb:29:in `new' Request

Parameters:

None Show session dump

Show env dump

Response

Headers:

None

????

I had the same error as stated and I didn't understand the example so I followed this guide: http://dashdingo.org/post/1627307077/sqlite3-sqlexception-table-already-exists

Now I cannot access the new status page at all, please help.

NoMethodError in Statuses#new

Showing /var/lib/stickshift/51c8b66b5973cac7c2000059/app-root/data/456597/app/views/statuses/_form.html.erb where line #17 raised:

undefined method `content' for # Extracted source (around line #17):

14: 15: 16: 17: <%= f.input :content %> 18: 19: <%= f.submit %> 20: Trace of template inclusion: app/views/statuses/new.html.erb

Rails.root: /var/lib/stickshift/51c8b66b5973cac7c2000059/app-root/data/456597

Application Trace | Framework Trace | Full Trace app/views/statuses/form.html.erb:17:in block in app_views_statusesform_html_erb4582378182949388460_70182754197540' app/views/statuses/_form.html.erb:1:in_app_views_statusesform_html_erb4582378182949388460_70182754197540' app/views/statuses/new.html.erb:3:in app_views_statuses_new_html_erb_4366996796839014421_70182754006920' app/controllers/statuses_controller.rb:29:innew' Request

Parameters:

None Show session dump

Show env dump

Response

Headers:

None

????

I had the same error as stated and I didn't understand the example so I followed this guide: http://dashdingo.org/post/1627307077/sqlite3-sqlexception-table-already-exists

Now I cannot access the new status page at all, please help.

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Try doing:

rake db:reset
rake db:create:all

I'm having the same issue on this step. Once I tried running both commands:

rake db:reset rake db:create:all

I got this error:

You have 1 pending migrations: 20130826192456 AddDeviseToUsers Run rake db:migrate to update your database then try again. unknown68a86d404924:treebook dennishegstad$ rake db:create:all db/development.sqlite3 already exists db/test.sqlite3 already exists db/production.sqlite3 already exists

Any help would be great! :D

i've tried that multiple times and end up with this error:

rake aborted! An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255)) /usr/local/rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:in `initialize'

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Do you have two migrations that say "create_users" in the file name somewhere? That's probably happening in this case. If so, delete one and try again.

Yup! I figured out the solution a few days ago and have progressed a lot further. Thanks so much.