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

Shawn Wilson
seal-mask
.a{fill-rule:evenodd;}techdegree
Shawn Wilson
iOS Development Techdegree Student 7,049 Points

bin/rake db:migrate issue

Good day all, while working in the todo list building module, i have hit a snag while running the bin/rake db:migrate command. Below is the command prompt error i get:

Shawns-MacBook-Pro:ToDo TaurenLTD1$ bin/rake db:migrate == 20150323182937 CreateTodoItems: migrating ================================== -- create_table(:todo_items) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:

undefined method refrences' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007fe9e206b6d8>/Users/TaurenLTD1/Desktop/projects/sample/ToDo/db/migrate/20150323182937_create_todo_items.rb:4:inblock in change'

I have refrenced line 4 and it was not what appeared in the video, in the video it showed the following:

class CreateTodoItems < ActiveRecord::Migration def change create_table :todo_items do |t| t.refrences :todo_list, index: true t.string :content

  t.timestamps null: false
end

end end

my generated model showed the following:

class CreateTodoItems < ActiveRecord::Migration def change create_table :todo_items do |t| t.refrences :todo_list t.string :content

  t.timestamps null: false
end

end end

as you can see the only difference is on line 4 ( t.refrences:todo_list) i have run both adding the ( ,index: true ) but both times i run the rake db:migrate i get the same error refrencing line 4.. can figure out where im going wrong here.

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

The error tells you everything: "undefined method refrences". It's just a typo: it should be references, not refrences - change that in your migration and it should pass, or at least it won't throw the same error ;). Check out this gem: https://github.com/yuki24/did_you_mean - if you add it to your gemfile, it will suggest alternative names of methods and variables that you may have mistyped (not sure if it would work in this case, but I always add it to my gemfile and save a lot of debugging time).