Sha256: 36241f2e4413abec959791a049b3b584857344989f104082aa45125e2451707e

Contents?: true

Size: 682 Bytes

Versions: 149

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/directory"

module Renalware
  module Directory
    class Person < ApplicationRecord
      include Personable
      include Accountable

      has_one :address, as: :addressable

      accepts_nested_attributes_for :address

      scope :ordered, -> { order(:family_name, :given_name) }
      scope :with_address, -> { includes(:address) }

      def self.policy_class
        BasePolicy
      end

      def self.build(attributes = {})
        person = new(attributes)
        person.build_address
        person
      end

      def to_s
        [family_name, given_name].compact.join(", ")
      end
    end
  end
end

Version data entries

149 entries across 149 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/directory/person.rb
renalware-core-2.1.0 app/models/renalware/directory/person.rb
renalware-core-2.0.167 app/models/renalware/directory/person.rb
renalware-core-2.0.166 app/models/renalware/directory/person.rb
renalware-core-2.0.165 app/models/renalware/directory/person.rb
renalware-core-2.0.164 app/models/renalware/directory/person.rb
renalware-core-2.0.163 app/models/renalware/directory/person.rb
renalware-core-2.0.162 app/models/renalware/directory/person.rb
renalware-core-2.0.161 app/models/renalware/directory/person.rb
renalware-core-2.0.160 app/models/renalware/directory/person.rb
renalware-core-2.0.159 app/models/renalware/directory/person.rb
renalware-core-2.0.158 app/models/renalware/directory/person.rb
renalware-core-2.0.157 app/models/renalware/directory/person.rb
renalware-core-2.0.156 app/models/renalware/directory/person.rb
renalware-core-2.0.155 app/models/renalware/directory/person.rb
renalware-core-2.0.153 app/models/renalware/directory/person.rb
renalware-core-2.0.152 app/models/renalware/directory/person.rb
renalware-core-2.0.151 app/models/renalware/directory/person.rb
renalware-core-2.0.149 app/models/renalware/directory/person.rb
renalware-core-2.0.148 app/models/renalware/directory/person.rb