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/relation_status.rb

30 lines
609 B
Ruby
Raw Normal View History

2019-09-21 10:37:06 -04:00
# frozen_string_literal: true
class RelationStatus < ApplicationRecord
2019-09-21 13:13:14 -04:00
################
# Associations #
################
has_many :outgoing_transitions,
2019-09-21 13:13:14 -04:00
class_name: 'RelationTransition',
inverse_of: :from_status,
foreign_key: :from_status_id,
dependent: :restrict_with_exception
2019-09-21 10:37:06 -04:00
###############
# Validations #
###############
2019-09-30 07:51:05 -04:00
validates :codename, codename: true, uniqueness: { case_sensitive: false }
2019-09-21 10:37:06 -04:00
2019-09-30 07:51:05 -04:00
validates :name, good_small_text: true, uniqueness: true
2019-09-21 10:37:06 -04:00
###########
# Methods #
###########
def to_param
codename
end
end