Sha256: 8aba87c8e1d66cc041b5a6e208cf728af2ec8a11c76fcbcc864b659bb52fa4da

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

module Popolo
  # A bounded area, like an administrative boundary.
  #
  # @note There is an upper limit to the number of administrative levels;
  #   however, there is little agreement as to what those levels are. Therefore,
  #   instead of having a different model for each administrative level – which
  #   would have advantages – we use a flexible tree structure.
  class Area
    include Mongoid::Document
    include Mongoid::Tree

    include Popolo::Sluggable
    index({slug: 1, parent_id: 1}, unique: true)

    # Memberships related to the area, e.g. officials.
    has_many :memberships, class_name: 'Popolo::Membership'
    # Organizations related to the area, e.g. governments.
    has_many :organizations, class_name: 'Popolo::Organization'
    # Posts related to the area, e.g. officials.
    has_many :posts, class_name: 'Popolo::Post'

    # The area's category.
    field :classification, type: String
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
popolo-0.0.2 app/models/popolo/area.rb
popolo-0.0.1 app/models/popolo/area.rb