Sha256: 8dfc8081165ed0f410a07e463094c3045019e27ea9efbee6e5a1f68741c208e1

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 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,  uniqueness: { :scope => :nation_id }



end

Version data entries

1 entries across 1 versions & 1 rubygems

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