Class: GeographicAreaType

Inherits:
ApplicationRecord show all
Includes:
Housekeeping::Timestamps, Housekeeping::Users, 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

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 Housekeeping::Timestamps

#data_breakdown_for_chartkick_recent

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods included from ActiverecordUtilities

#trim_attributes

Instance Attribute Details

- (String) name

The name of the geographic area type.

Returns:

  • (String)


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

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

  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