Sha256: c0d2592547da4c8dc5b74a22ddeac77f7a795c99938228e40a46c81e68f41708

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 Bytes

Contents

class Region
  include Mongoid::Document
  include Geopolitical::Helpers

  field :gid,    type: Integer  # geonames id
  field :slug,   type: String
  field :name,   type: String,  localize: true
  field :abbr,   type: String
  field :codes,  type: Array # phone codes

  belongs_to :nation

  has_many :cities, :dependent => :destroy

  scope :ordered, order_by(name: 1)

  validates :nation, presence: true
  validates :name,   presence: true

  validates :name,   uniqueness: { :scope => :nation_id }


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geopolitical-0.8.0 app/models/region.rb