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 ActiveRecord Basics Migrations and Relationships Has and Belongs to Many

Kevin Hackett
Kevin Hackett
10,441 Points

Table 'biller_development.employees_projects' doesn't exist:

Hi,

When following along to the tutorial, I get this error in the rails console after I create the employee and assign it to the p variable (time: 6.50)

irb(main):006:0> p.employees

Mysql2::Error: Table 'biller_development.employees_projects' doesn't exist: SHOW FULL FIELDS FROM employees_projects ActiveRecord::StatementInvalid: Mysql2::Error: Table 'biller_development.employees_projects' doesn't exist: SHOW FULL FIELDS FROM employees_projects

I have checked all the code in the models and everything seems to be correct but I'm lost as to why this error is coming up. The EmployeesProjects class has been created also. Does anyone have an idea as to why this is happening?

1 Answer

Hampton Catlin
STAFF
Hampton Catlin
Treehouse Guest Teacher

It means that you haven't run your migrations yet. In the "Ruby World" you have everything setup correctly, but the database hasn't been updated to match the way the models are setup.

rake db:migrate

Should fix you right up!

Fenian Noakes
Fenian Noakes
Courses Plus Student 5,212 Points

Hi Hampton, I have come across the exact same error - and have tried $rake db:migrate but the same error is still occurs. Any help would be great - not sure where to go on this now. cheers

2.2.1 :004 > p = Project.first Project Load (0.2ms) SELECT projects.* FROM projects ORDER BY projects.id ASC LIMIT 1 => #<Project id: 1, name: "Death Star", customer_id: 1, created_at: "2015-09-19 03:58:55", updated_at: "2015-09-19 03:58:55"> 2.2.1 :005 > p.employees Mysql2::Error: Table 'biller_development.employee_projects' doesn't exist: SHOW FULL FIELDS FROM employee_projects ActiveRecord::StatementInvalid: Mysql2::Error: Table 'biller_development.employee_projects' doesn't exist: SHOW FULL FIELDS FROM employee_projects .....etc