Sha256: b20479c25de016eea81fc289d2603e3aaf675dbff91d077d36bab5be74fb2b5b

Contents?: true

Size: 522 Bytes

Versions: 8

Compression:

Stored size: 522 Bytes

Contents

module CurationConcern
  module WithLinkedResources
    extend ActiveSupport::Concern

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

    included do

      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

8 entries across 8 versions & 1 rubygems

Version Path
curate-0.6.6 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.6.5 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.6.4 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.6.3 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.6.1 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.6.0 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.5.6 app/repository_models/curation_concern/with_linked_resources.rb
curate-0.5.5 app/repository_models/curation_concern/with_linked_resources.rb