Sha256: ad392e67413e43f586aabbbe3f9aa7e015f06d3be0a96c0169193676f90a2496

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

module Popolo
  # A position in an organization that exists independently of the person
  # holding it.
  class Post
    include Mongoid::Document

    def self.slug_source
      :role
    end

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

    # An area related to the post, e.g. an electoral riding.
    belongs_to :area, index: true, class_name: 'Popolo::Area'
    # The organization in which the post exists.
    belongs_to :organization, index: true, class_name: 'Popolo::Organization'
    # The person holding the post.
    belongs_to :person, index: true, class_name: 'Popolo::Person'
    # The address at which the post is based.
    embeds_many :addresses, as: :addressable, class_name: 'Popolo::Address'

    validates_presence_of :organization_id
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
popolo-0.0.1 app/models/popolo/post.rb