Sha256: 440b67e9d48f0f65f20c6b3855e52a92815d49aedf6c38284c0722083db212a4

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

module Curate
  module UserBehavior
    module WithAssociatedPerson
      extend ActiveSupport::Concern

      included do
        person_attributes_not_already_on_base =
          Person.registered_attribute_names - attribute_names_for_account

        person_attributes_not_already_on_base.each do |attribute_name|
          delegate attribute_name, to: :person
        end
        delegate :profile, to: :person, allow_nil: true
      end

      def reload
        @person = nil
        super
      end

      def person
        @person ||= if self.repository_id
                      Person.find(self.repository_id)
                    else
                      Person.new(name: name)
                    end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curate-0.5.4 app/models/curate/user_behavior/with_associated_person.rb
curate-0.5.2 app/models/curate/user_behavior/with_associated_person.rb