Sha256: d9884f2de7e5a78a52d1ce65f4726d91bbb49c4308f919bf5e54b8262c4dad87
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 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, class_name: 'City' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-0.9.5 | app/models/region.rb |