class User < ApplicationRecord
has_many :groups
has_many :memberships
has_many :groups, through: :memberships
end
class users < ApplicationRecord
belongs_to :group
has_many :memberships
has_many :groups, through: :memberships
end
class memberships < ApplicationRecord
belongs_to :user
belongs_to :group
end
関係に問題があります。has_many belongs_to and has_many through、この問題を解決するにはどうすればいいですか?