class ParentRelationship
Schema Information
Table name: parent_relationships
id :bigint not null, primary key other_name :string type :string not null created_at :datetime not null updated_at :datetime not null parent_id :bigint not null patient_id :bigint not null
Indexes
index_parent_relationships_on_parent_id_and_patient_id (parent_id,patient_id) UNIQUE index_parent_relationships_on_patient_id (patient_id)
Foreign Keys
fk_rails_... (parent_id => parents.id) fk_rails_... (patient_id => patients.id)
Public Instance Methods
Source
# File app/models/parent_relationship.rb, line 55 def label other? ? "Other – #{other_name}" : human_enum_name(:type).capitalize end
Source
# File app/models/parent_relationship.rb, line 59 def label_with_parent unknown? ? parent.label : "#{parent.label} (#{label.downcase_first})" end
Source
# File app/models/parent_relationship.rb, line 63 def ordinal_label index = patient.parent_relationships.find_index(self) if index.nil? "parent or guardian" elsif index <= 10 "#{I18n.t(index + 1, scope: :ordinal_number)} parent or guardian" else "#{index.ordinalize} parent or guardian" end end