Sha256: f2aea41ec76eb2fe92836fff2b3d0cabb422069e1e3e5488868622a424fb96d1
Contents?: true
Size: 669 Bytes
Versions: 2
Compression:
Stored size: 669 Bytes
Contents
# # Region/Province/Estado # class Region include Mongoid::Document include Geopolitocracy field :timezone, type: String belongs_to :nation has_many :cities, dependent: :destroy belongs_to :capital, inverse_of: :region_capital, class_name: 'City', optional: true validates :nation, presence: true validates :name, uniqueness: { scope: :nation_id } validates :abbr, uniqueness: { scope: :nation_id, allow_nil: true } index abbr: 1 index nation_id: 1, name: 1 # National dialing code / or International def phone self[:phone] || nation.phone end def postal self[:postal] || nation.postal end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-3.0.0 | app/models/region.rb |
geopolitical-2.0.0 | app/models/region.rb |