Sha256: 398e2489bbcf24b851a31fa5b8be6990de56ad9a684c98059fdfb719da184155
Contents?: true
Size: 1.3 KB
Versions: 8
Compression:
Stored size: 1.3 KB
Contents
module Pupa # A relationship between a person and an organization. class Membership include Model self.schema = 'popolo/membership' include Concerns::Timestamps include Concerns::Sourceable include Concerns::Contactable include Concerns::Linkable attr_accessor :label, :role, :member, :person_id, :organization_id, :post_id, :on_behalf_of_id, :area_id, :start_date, :end_date dump :label, :role, :member, :person_id, :organization_id, :post_id, :on_behalf_of_id, :area_id, :start_date, :end_date foreign_key :person_id, :organization_id, :post_id, :on_behalf_of_id, :area_id # Returns the IDs of the parties to the relationship. # # @return [String] the IDs of the parties to the relationship def to_s "#{person_id} in #{organization_id}" end # A person's relationship with an organization must have a unique label, # though it may share a label with a historical relationship. Similarly, a # person may hold a post in an organization multiple times historically but # not simultaneously. def fingerprint hash = super { '$or' => [ hash.slice(:label, :person_id, :organization_id, :end_date), hash.slice(:person_id, :organization_id, :post_id, :end_date), ], } end end end
Version data entries
8 entries across 8 versions & 1 rubygems