Sha256: 27d839d9534f3799bf0006fa80203a1ed17d1497d2f02454145728eb630163fd

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 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
          delegate :profile, to: :person
        end
      end

      def reload
        @person = nil
        super
      end

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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curate-0.5.1 app/models/curate/user_behavior/with_associated_person.rb
curate-0.5.0 app/models/curate/user_behavior/with_associated_person.rb
curate-0.4.2 app/models/curate/user_behavior/with_associated_person.rb