Sha256: 9a296b8eefe6b91af873d6c0eed1456f3c76850fbda3089ca94ded2f4967632b

Contents?: true

Size: 500 Bytes

Versions: 4

Compression:

Stored size: 500 Bytes

Contents

module CurationConcern
  module WithGenericFiles
    extend ActiveSupport::Concern

    included do
      has_many :generic_files, property: :is_part_of

      after_destroy :after_destroy_cleanup_generic_files
    end

    def after_destroy_cleanup_generic_files
      generic_files.each(&:destroy)
    end

    def representative_generic_file_object
      return nil if self.representative.nil?
      @representative_generic_file_object ||= GenericFile.find(self.representative)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curate-0.5.6 app/repository_models/curation_concern/with_generic_files.rb
curate-0.5.5 app/repository_models/curation_concern/with_generic_files.rb
curate-0.5.4 app/repository_models/curation_concern/with_generic_files.rb
curate-0.5.2 app/repository_models/curation_concern/with_generic_files.rb