Sha256: 1cf6562c09a1f6c935ec3f01d9b05f361ac5fb7f1ac0f454ea2d9461ebd9bce7

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 Bytes

Contents

class Zone
  include Mongoid::Document

  field :gid,    type: Integer  # geonames id
  field :slug,   type: String
  field :name,   type: String,  localize: true
  field :abbr,   type: String
  field :kind,   type: String

  has_many :zone_members, :dependent => :destroy

  scope :ordered, order_by(name: 1)

  validates :name, presence: true, uniqueness: true


  def members
    zone_members.map(&:member)
  end

  def to_s
    name
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geopolitical-0.8.1 app/models/zone.rb
geopolitical-0.8.0 app/models/zone.rb