Sha256: c41a307b95968d6bf313963e5dc3b76a67d9910982292ec1879e45b9d35dac98

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

#
# Nation/Country/Flag
#
class Nation
  include Mongoid::Document
  include Geopolitical::Helpers

  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.2 app/models/nation.rb