エラー内容
has_many throughでなんとかなんとかって出てくる。
エラー元のソースコード
group.rb
class Group < ApplicationRecord
has_many :users, through: :group_users
has_many :group_users
end
原因と考えられるもの
エラー文からgroup_users
が中間テーブルのアソシエーションの後に来てることが原因だと考えた。
解決コード
group.rb
class Group < ApplicationRecord
#group_usersのコードをthroughの前に持ってくる。
has_many :group_users
has_many :users, through: :group_users
end