Sha256: 3133153157d795077bf6c90a45371ea308220b0e8cc1c63b6f6b33f4401fea1f

Contents?: true

Size: 527 Bytes

Versions: 2

Compression:

Stored size: 527 Bytes

Contents

module CurationConcern
  module WithLinkedResources
    extend ActiveSupport::Concern

    included do
      unless included_modules.include?(ActiveFedora::RegisteredAttributes)
        include ActiveFedora::RegisteredAttributes
      end

      attribute :linked_resource_urls, multiple: true

      has_many :linked_resources, property: :is_part_of

      after_destroy :after_destroy_cleanup_linked_resources
    end

    def after_destroy_cleanup_linked_resources
      linked_resources.each(&:destroy)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curate-0.5.4 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.5.2 app/repository_models/curation_concern/with_linked_resources.rb