class User < ApplicationRecord
has_many :quizzes, through: :results
class Result < ApplicationRecord
class Quiz < ApplicationRecord
has_many :users, through: :results
has_and_belongs_to_many association does not have a model for the join entities there is no straight forward way to query it directly or add additional columns to the join table.
Here you would create the "result/score" by something like:
@quiz.results.create(user: current_user, score: 99)
has_and_belongs_to_many is only actually a good idea if you know that you'll never need those features and the memory savings from not instanciating join models. This is only the case if the join entity is not an actual "thing" in itself.