Sha256: 57fce38755683bae0cefd1ec9026e4837de5f20a0d07146f6bf385a3c048c3bb

Contents?: true

Size: 518 Bytes

Versions: 9

Compression:

Stored size: 518 Bytes

Contents

# Copied from Curate
module CurationConcern
  module WithGenericFiles
    extend ActiveSupport::Concern

    included do
      has_many :generic_files, property: :is_part_of, class_name: "Worthwhile::GenericFile"
      before_destroy :before_destroy_cleanup_generic_files
    end

    def before_destroy_cleanup_generic_files
      generic_files.each(&:destroy)
    end

    def copy_visibility_to_files
      generic_files.each do |gf|
        gf.visibility = visibility
        gf.save!
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
worthwhile-0.1.2 worthwhile-models/app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-models-0.1.2 app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-0.1.1 worthwhile-models/app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-models-0.1.1 app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-0.1.0 worthwhile-models/app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-models-0.1.0 app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-0.0.3 app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-0.0.2 app/models/concerns/curation_concern/with_generic_files.rb
worthwhile-0.0.1 app/models/concerns/curation_concern/with_generic_files.rb