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

Fenian Noakes
PLUS
Fenian Noakes
Courses Plus Student 5,212 Points

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

Hi there, I am stuck on this error @6:51 of this stage. ("Has and Belongs to Many") After I type in the following; $rails c $p = Project.first $p.employees I then get the below error;

2.2.1 :001 > p = Project.first Project Load (0.4ms) 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 :002 > 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 from /Users/feniannoakes/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'

I then exited from the console - and tried; $rake db:migrate but that didn't help.

I have loaded my code onto gihub

https://github.com/Fen77/ActiveRecord_basics

Any help would be greatly appreciated. Thanks

1 Answer

has_and_belongs_to_many :employees, join_table: "employees_projects" join the table like this and rollback and migrate again