class GoalAccount < ApplicationRecord belongs_to :goal belongs_to :account validates :account_id, uniqueness: { scope: :goal_id } end