Sha256: 621863e5faf5866971d5dae51b8838cbd294b5724bb5c8430575210ac8f07286

Contents?: true

Size: 658 Bytes

Versions: 10

Compression:

Stored size: 658 Bytes

Contents

module Hyrax
  module Actors
    class AssignRepresentativeActor < AbstractActor
      def create(attributes)
        next_actor.create(attributes) && assign_representative
      end

      private

        def assign_representative
          unless curation_concern.representative_id
            # TODO: Possible optimization here. Does this cause a fetch of ordered_members if they're already loaded?
            representative = nil # curation_concern.ordered_members.association.reader.first.target
            curation_concern.representative = representative if representative
          end
          curation_concern.save
        end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.1.0 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.5 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.4 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.3 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.2 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.1 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.0.rc2 app/actors/hyrax/actors/assign_representative_actor.rb
hyrax-1.0.0.rc1 app/actors/hyrax/actors/assign_representative_actor.rb
test_hyrax-0.0.1.alpha app/actors/hyrax/actors/assign_representative_actor.rb