Sha256: 0721e2bdf134b719f4165ee637353f10e3c0424e5e8f8cade1a288fba2432a4a

Contents?: true

Size: 843 Bytes

Versions: 13

Compression:

Stored size: 843 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, :role, :organization_id, :start_date, :end_date
    dump :label, :role, :organization_id, :start_date, :end_date

    foreign_key :organization_id

    # Returns the post's label and organization ID.
    #
    # @return [String] the post's label and organization ID
    def to_s
      "#{label} 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

13 entries across 13 versions & 1 rubygems

Version Path
pupa-0.1.7 lib/pupa/models/post.rb
pupa-0.1.6 lib/pupa/models/post.rb
pupa-0.1.5 lib/pupa/models/post.rb
pupa-0.1.4 lib/pupa/models/post.rb
pupa-0.1.3 lib/pupa/models/post.rb
pupa-0.1.2 lib/pupa/models/post.rb
pupa-0.1.1 lib/pupa/models/post.rb
pupa-0.1.0 lib/pupa/models/post.rb
pupa-0.0.13 lib/pupa/models/post.rb
pupa-0.0.12 lib/pupa/models/post.rb
pupa-0.0.11 lib/pupa/models/post.rb
pupa-0.0.10 lib/pupa/models/post.rb
pupa-0.0.9 lib/pupa/models/post.rb