Sha256: 53fc0d42b7392e159b632f17997653676d28822c6a7150b7592f9e2a3ce61036

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

#
# Nation/Country/Flag
#
class Nation
  include Mongoid::Document
  include GeoHelper

  field :_id, type: String, default: ->{ abbr }

  field :gid,    type: Integer  # geonames id
  field :slug,   type: String
  field :name,   type: String, localize: true
  field :abbr,   type: String
  field :code    # optional phone/whatever code
  field :zip,    type: String
  field :cash,   type: String
  field :lang,   type: String

  has_many :regions, dependent: :destroy
  has_many :cities,  dependent: :destroy

  scope :ordered, -> { order_by(name: 1) }

  validates :slug, :abbr, uniqueness: true, presence: true

  alias :currency :cash

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geopolitical-0.8.3 app/models/nation.rb