I have three classes: School, Account, and Administratorship.
School
For Rails 5, returningfalse won't halt the callback chain. You need to use throw(:abort)
belongs_to :account belongs_to :school
before_destroy :confirm_presence_of_alternate_administratorship_in_school
protected
def confirm_presence_of_alternate_administratorship_in_school
unless school.administrators.count(["administratorships.account_id != #{id}"]) > 0
errors.add_to_base "The school must have at least one administrator"
throw(:abort)
end
end