Class: GeographicAreaType

Inherits:
ApplicationRecord show all
Includes:
Housekeeping::Timestamps, Housekeeping::Users, Shared::IsApplicationData, Shared::IsData
Defined in:
app/models/geographic_area_type.rb

Overview

A GeographicAreaType is a string describing the (generally local) name for the (generally) political designation of the area.

Constant Summary collapse

COUNTRY_LEVEL_TYPES =
%w(Country Governorate).freeze
STATE_LEVEL_TYPES =
%w(State Province District Prefecture Region Territory Republic Area Oblast Krai).freeze
COUNTY_LEVEL_TYPES =
%w(County Parish Borough Canton Department Raion).freeze

Instance Attribute Summary collapse

Attributes included from Housekeeping::Users

#by

Method Summary

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#nameString

The name of the geographic area type.

Returns:

  • (String)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/geographic_area_type.rb', line 8

class GeographicAreaType < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData
  include Shared::IsApplicationData

  COUNTRY_LEVEL_TYPES = %w(Country Governorate).freeze
  STATE_LEVEL_TYPES   = %w(State Province District Prefecture Region Territory Republic Area Oblast Krai).freeze
  COUNTY_LEVEL_TYPES  = %w(County Parish Borough Canton Department Raion).freeze

  has_many :geographic_areas, inverse_of: :geographic_area_type

  validates :name, uniqueness: true, presence: true
end