Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Scaffold

I keep receiving errors every time I try to run "rake db:migrate". How do I fix this??

annies-laptop:odot annharris$ bin/rake db:migrate Running via Spring preloader in process 81698 [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. [DEPRECATION] last_comment is deprecated. Please use last_description instead. == 20160503211616 CreateTodoLists: migrating ================================== -- create_table(:todo_lists) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

undefined method stringdescription' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007fe7f1abe498> /Users/annharris/Desktop/treehouse/odot/db/migrate/20160503211616_create_todo_lists.rb:4:inblock in change' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:202:in create_table' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:inblock in method_missing' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in block in say_with_time' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:insay_with_time' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in method_missing' /Users/annharris/Desktop/treehouse/odot/db/migrate/20160503211616_create_todo_lists.rb:3:inchange' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:608:in exec_migration' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:inblock (2 levels) in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in block in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:inwith_connection' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:inmigrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in block in execute_migration_in_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:inblock in ddl_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in block in transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:inwithin_new_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:intransaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in ddl_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:inexecute_migration_in_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in block in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:ineach' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:inup' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:inmigrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in block (2 levels) in <top (required)>' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:inload' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in block in load' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:inload_dependency' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' -e:1:in<main>' NoMethodError: undefined method stringdescription' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007fe7f1abe498> /Users/annharris/Desktop/treehouse/odot/db/migrate/20160503211616_create_todo_lists.rb:4:inblock in change' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:202:in create_table' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:inblock in method_missing' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in block in say_with_time' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:insay_with_time' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in method_missing' /Users/annharris/Desktop/treehouse/odot/db/migrate/20160503211616_create_todo_lists.rb:3:inchange' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:608:in exec_migration' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:inblock (2 levels) in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in block in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:inwith_connection' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:inmigrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in block in execute_migration_in_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:inblock in ddl_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in block in transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:inwithin_new_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:intransaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in ddl_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:inexecute_migration_in_transaction' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in block in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:ineach' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:inup' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in migrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:inmigrate' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in block (2 levels) in <top (required)>' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:inload' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in block in load' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:inload_dependency' /Users/annharris/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' -e:1:in<main>' Tasks: TOP => db:migrate (See full trace by running task with --trace)

Seth Kroger
Seth Kroger
56,360 Points

Can you post the migration's script? I appears there's an error in it.

Seth Kroger - How do I do that? I'm a beginner trying to follow along with the videos.

2 Answers

Daniel Cox
Daniel Cox
15,966 Points

Hey @annhnova,

In the db/migrate folder ... there is a file called 20160503211616_create_todo_lists.rb.

Open that file and you have a error around line 4.

Linda Joy
Linda Joy
5,415 Points

I have this problem as well -- how can you tell what the error is or how to fix it?

Daniel Cox
Daniel Cox
15,966 Points

Are you still having the problem?