Sha256: 507170d21720e91f0b45b17f3c1e3d1034a4a1fd8ed805dd6fd16b92c8c33f5e
Contents?: true
Size: 570 Bytes
Versions: 1
Compression:
Stored size: 570 Bytes
Contents
# Geopolitical Helpers module Geopolitocracy extend ActiveSupport::Concern included do field :name, type: String, localize: true field :abbr, type: String field :gid, type: Integer # geonames id field :slug, type: String field :ascii, type: String field :code, type: String before_validation :set_slug end def to_s name || slug end def set_slug self.slug ||= name end def slug=(txt) return unless txt self[:slug] = txt.encode(Encoding::ISO_8859_1) .gsub(/\s/, '-').downcase end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-0.8.4 | app/models/concerns/geopolitocracy.rb |