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

35 lines
649 B
Ruby

# frozen_string_literal: true
class ContactNetwork < ApplicationRecord
################
# Associations #
################
has_many :contacts
###############
# Validations #
###############
validates :codename, codename: true, uniqueness: { case_sensitive: false }
validates :name, good_small_text: true, uniqueness: true
validates :link,
allow_nil: true,
allow_blank: false,
presence: true,
format: { with: /\A[^\s]+\z/ }
###########
# Methods #
###########
def to_param
codename
end
def communicable?
%w[email telegram_id].include? codename
end
end