Sha256: 41ab99584bc68ad6d2e060e77cfac72acb1826b3137658a0141816c2c31b787a

Contents?: true

Size: 934 Bytes

Versions: 8

Compression:

Stored size: 934 Bytes

Contents

module Pupa
  # A position that exists independent of the person holding it.
  class Post
    include Model

    self.schema = 'popolo/post'

    include Concerns::Timestamps
    include Concerns::Sourceable
    include Concerns::Contactable
    include Concerns::Linkable

    attr_accessor :label, :other_label, :role, :organization_id, :area_id, :start_date, :end_date
    dump          :label, :other_label, :role, :organization_id, :area_id, :start_date, :end_date

    foreign_key :organization_id, :area_id

    # Returns the post's label or role and organization ID.
    #
    # @return [String] the post's label or role and organization ID
    def to_s
      "#{label || role} in #{organization_id}"
    end

    # A post should have a unique label within an organization, through it may
    # share a label with a historical post.
    def fingerprint
      super.slice(:label, :organization_id, :end_date)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pupa-0.2.3 lib/pupa/models/post.rb
pupa-0.2.2 lib/pupa/models/post.rb
pupa-0.2.1 lib/pupa/models/post.rb
pupa-0.2.0 lib/pupa/models/post.rb
pupa-0.1.11 lib/pupa/models/post.rb
pupa-0.1.10 lib/pupa/models/post.rb
pupa-0.1.9 lib/pupa/models/post.rb
pupa-0.1.8 lib/pupa/models/post.rb