1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/models/relationship.rb

28 lines
590 B
Ruby

# frozen_string_literal: true
class Relationship < ApplicationRecord
enum status: %i[unrelated supporter member excluded]
################
# Associations #
################
belongs_to :person
belongs_to :regional_office
###############
# Validations #
###############
validates :number,
presence: true,
uniqueness: { scope: :person_id },
numericality: {
only_integer: true,
greater_than_or_equal_to: 0,
}
validates :active_since, presence: true
validates :status, presence: true
end