Sha256: 61c4d700ec3c671772696b8213cfd5b2ce88cfa70d15b7de515d35f465607e48
Contents?: true
Size: 883 Bytes
Versions: 1
Compression:
Stored size: 883 Bytes
Contents
# # Nation/Country/Flag # class Nation include Mongoid::Document include Geopolitocracy field :_id, type: String, default: -> { abbr } field :gid, type: Integer # geonames id field :tld, type: String # Top level domain field :cash, type: String # Currency prefix field :code3, type: String # Iso 3166_3 field :lang, type: String # Official/main language field :langs, type: Array # All official languages alias_method :currency, :cash alias_method :iso_3166_3, :code3 validates :abbr, uniqueness: true, presence: true belongs_to :capital, class_name: 'City' has_many :regions, dependent: :destroy has_many :cities, dependent: :destroy index lang: 1 def abbr=(txt) self[:abbr] = txt && txt.upcase end def ==(other) return unless other abbr == other.abbr end def <=>(other) name <=> other.name end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-0.9.5 | app/models/nation.rb |