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

30 lines
570 B
Ruby
Raw Normal View History

2018-11-30 11:24:05 -05:00
# frozen_string_literal: true
2018-11-30 11:32:43 -05:00
class CountryState < ApplicationRecord
2019-03-25 20:56:31 -04:00
################
# Associations #
################
2018-12-06 17:49:50 -05:00
has_one :regional_office, dependent: :restrict_with_exception
has_many :membership_apps, dependent: :restrict_with_exception
2019-03-25 20:56:31 -04:00
###############
# Validations #
###############
2019-03-24 16:52:10 -04:00
validates :english_name, presence: true, uniqueness: true
2019-03-24 17:10:10 -04:00
validates :native_name, presence: true, uniqueness: true
2019-03-24 17:37:36 -04:00
2019-03-25 20:56:31 -04:00
###########
# Methods #
###########
2019-03-24 17:37:36 -04:00
def display_name
return native_name if I18n.locale == :ru
english_name
end
2018-11-30 11:24:05 -05:00
end