Sha256: 158e81cb278244a14eda7d81e22842b768021d3dc91f6218745eeb086afe67cb
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
module Popolo # A real person, alive or dead. class Person include Mongoid::Document include Popolo::Sluggable index({slug: 1}, unique: true) # The relationships to which the person is a party. has_many :memberships, class_name: 'Popolo::Membership' # The posts held by the person. has_many :posts, class_name: 'Popolo::Post' # The person's alternate or former names. embeds_many :other_names, as: :nameable, class_name: 'Popolo::OtherName' # Links to pages about this person, e.g. Wikipedia, or to accounts this # person has on other websites, e.g. Twitter. embeds_many :links, class_name: 'Popolo::Link' # The person's family name. field :family_name, type: String # The person's given name. field :given_name, type: String # An additional name, e.g. a middle name. field :additional_name, type: String # An honorific prefix before the person's name, e.g. "Dr.". field :honorific_prefix, type: String # An honorific suffix after the person's name, e.g. "Jr.". field :honorific_suffix, type: String # The person's email address. field :email, type: String # The person's gender, e.g. "male", "female" or another value. field :gender, type: String # The person's date of birth in ISO 8601:2004 format. field :birth_date, type: String # The person's date of death in ISO 8601:2004 format. field :death_date, type: String # The URL of the person's head shot. field :image, type: String # The person's one-line biography. field :summary, type: String # The person's extended biography. field :biography, type: String # @note Add email address validation to match JSON Schema? # @note Add URL validation to match JSON Schema? validates_format_of :birth_date, with: /\A\d{4}(-\d{2}){0,2}\z/, allow_blank: true validates_format_of :death_date, with: /\A\d{4}(-\d{2}){0,2}\z/, allow_blank: true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
popolo-0.0.2 | app/models/popolo/person.rb |
popolo-0.0.1 | app/models/popolo/person.rb |