app/jobs/toggle_downloads_job.rb
# Allow or disallow downloads for an entire collection.
# downloadable = true/false
Allow or disallow downloads for an entire collection.
downloadable = true/false
Allow or disallow downloads for an entire collection . downloadable = true / false
def perform(collection_id, user_email, downloadable)
    collection = Collection.find(collection_id)
    works = GenericWork.where(member_of_collection_ids_ssim: collection_id)
    works.each do |work|
      work.downloadable = ActiveModel::Type::Boolean.new.cast(downloadable)
      work.save
    end
    DownloadsMailer.with(user_email: user_email.gsub('-dot-', '.'), id: collection_id, downloadable: downloadable).send_email.deliver_now
  end
def perform ( collection_id , user_email , downloadable ) collection = Collection . find ( collection_id ) works = GenericWork . where ( member_of_collection_ids_ssim : collection_id ) works . each do | work | work . downloadable = ActiveModel :: Type :: Boolean . new . cast ( downloadable ) work . save end DownloadsMailer . with ( user_email : user_email . gsub ( '-dot-' , '.' ) , id : collection_id , downloadable : downloadable ) . send_email . deliver_now end
Allow or disallow downloads for an entire collection.
Allow or disallow downloads for an entire collection .
collection_id
<not_specific>
user_email
<not_specific>
downloadable
<not_specific>