class ScoringCriterium < ApplicationRecord has_many :scores, dependent: :destroy validates :name, :category, presence: true def self.grouped_by_category ScoringCriterium.all.group_by(&:category) end end