Sha256: c6d6b6dff6de2b325b4aa8a38c04eb940772820d823f8e3eeecd82397cbb5c4f

Contents?: true

Size: 651 Bytes

Versions: 27

Compression:

Stored size: 651 Bytes

Contents

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

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/directory/person.rb
renalware-core-2.0.7 app/models/renalware/directory/person.rb
renalware-core-2.0.5 app/models/renalware/directory/person.rb
renalware-core-2.0.4 app/models/renalware/directory/person.rb
renalware-core-2.0.3 app/models/renalware/directory/person.rb
renalware-core-2.0.2 app/models/renalware/directory/person.rb
renalware-core-2.0.1 app/models/renalware/directory/person.rb
renalware-core-2.0.0 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/directory/person.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/directory/person.rb