Sha256: f2edcd0d8292ef6e28b0108d615eeeb7d2ae7787b6b9a3a0f4fd4c1c145d373d
Contents?: true
Size: 913 Bytes
Versions: 4
Compression:
Stored size: 913 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, inverse_of: :nation_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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-1.0.2 | app/models/nation.rb |
geopolitical-1.0.0 | app/models/nation.rb |
geopolitical-0.9.9 | app/models/nation.rb |
geopolitical-0.9.7 | app/models/nation.rb |