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 Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Scaffold

Nomethoderror during bin/rake

Hello, I keep getting my rake aborted and I don't understand why. I tried to search what the NoMethodError and private method String called... are, but haven't really found a good answers. Can anybody help me find out how to troubleshoot this issue? Below here is the error message after running the bin/rake db:migrate. Below that is the message after typing in "--trace". I don't know if that helps find a solution, but in case it does, I will include it in this message. Thanks a lot to anyone willing to explain what the Nomethoderror is and how I might be able to solve it!

Macintosh:odot usuario$ bin/rake db:migrate == 20150105012513 CreateTodoLists: migrating ================================== -- create_table(:todo_lists) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

private method String' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8fcf929af8>/Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:4:inblock in change' /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:3:in change' -e:1:in<main>' NoMethodError: private method String' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8fcf929af8> /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:4:inblock in change' /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:3:in change' -e:1:in<main>' Tasks: TOP => db:migrate (See full trace by running task with --trace)


Macintosh:odot usuario$ bin/rake db:migrate --trace

** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:migrate == 20150105012513 CreateTodoLists: migrating ================================== -- create_table(:todo_lists) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

private method String' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8fcea35240>/Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:4:inblock in change' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:198:in create_table' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:inblock in method_missing' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in block in say_with_time' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/benchmark.rb:279:inmeasure' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in say_with_time' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:inmethod_missing' /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:3:in change' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:595:inexec_migration' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in block (2 levels) in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/benchmark.rb:279:inmeasure' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in block in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:inwith_connection' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:inmigrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in block in execute_migration_in_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:inblock in ddl_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in block in transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:inwithin_new_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:intransaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in ddl_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:inexecute_migration_in_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in block in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:ineach' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:inup' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:inblock (2 levels) in <top (required)>' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in call' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:inblock in execute' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in each' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:inexecute' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in block in invoke_with_call_chain' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in invoke_with_call_chain' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:ininvoke' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in invoke_task' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:inblock (2 levels) in top_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in each' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:inblock in top_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in run_with_threads' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:intop_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in block in run' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:instandard_exception_handling' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in run' /Users/usuario/Documents/webex/odot/bin/rake:8:in<top (required)>' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in load' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:inblock in load' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in load_dependency' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:inload' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' -e:1:in <main>' NoMethodError: private methodString' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8fcea35240> /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:4:in block in change' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:198:increate_table' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in block in method_missing' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:inblock in say_with_time' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/benchmark.rb:279:in measure' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:insay_with_time' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in method_missing' /Users/usuario/Documents/webex/odot/db/migrate/20150105012513_create_todo_lists.rb:3:inchange' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:595:in exec_migration' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:inblock (2 levels) in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/benchmark.rb:279:in measure' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:inblock in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in with_connection' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:inmigrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:inblock in execute_migration_in_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in block in ddl_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:inblock in transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in within_new_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:intransaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:inddl_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in execute_migration_in_transaction' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:inblock in migrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in each' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:inmigrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in up' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:inmigrate' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in block (2 levels) in <top (required)>' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:incall' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in block in execute' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:ineach' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in execute' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:inblock in invoke_with_call_chain' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:ininvoke_with_call_chain' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in invoke' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:ininvoke_task' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in block (2 levels) in top_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:ineach' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in block in top_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:inrun_with_threads' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in top_level' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:inblock in run' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in standard_exception_handling' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:inrun' /Users/usuario/Documents/webex/odot/bin/rake:8:in <top (required)>' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:inload' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in block in load' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:inload_dependency' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in load' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' /Users/usuario/.rbenv/versions/2.1.4/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' -e:1:in<main>' Tasks: TOP => db:migrate

2 Answers

I actually just found my the issue after hours of trying to figure it out. Thanks anyways!!

The 's' in t.string :title was capitalized for some reason and shouldn't have been. this was the issue.

class CreateTodoLists < ActiveRecord::Migration
  def change
    create_table :todo_lists do |t|
      t.String :title
      t.text :description
      t.timestamps
    end
  end
end

Thanks a lot for the help!

Stone Preston
Stone Preston
42,016 Points

post the code that inside your latest migration inside db/migrate