Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Join table

Hi everyone, I stucked with the community app, when I run user.forums << Forum.find_by(name: "Ruby") I get the error below:

user.forums << Forum.find_by(name: "Ruby") Forum Load (0.1ms) SELECT "forums".* FROM "forums" WHERE "forums"."name" = ? LIMIT ? [["name", "Ruby"], ["LIMIT", 1]] (0.1ms) begin transaction (0.0ms) rollback transaction Traceback (most recent call last): 16: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- each' 15: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- in create_binds_for_hash' 14: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- build_bind_param' 13: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-' 12: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- type_for_attribute' 11: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-' 10: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- load_schema' 9: from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/monitor.rb:230:inmon_synchronize' 8: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- block in load_schema' 7: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-!' 6: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- load_schema!' 5: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-!' 4: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- columns_hash' 3: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-' 2: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord- columns' 1: from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-' ActiveRecord::StatementInvalid (Could not find table 'forums_users')

1 Answer

I got the answer:

After creating the join table migration we need to run bin/rails db:migrate