@ -5,6 +5,8 @@ class CsvDownloadsController < ApplicationController
csv_download = CsvDownload.find(params[:id])
authorize csv_download
return render "errors/download_link_expired" if csv_download.expired?
downloader = Csv::Downloader.new(csv_download:)
if Rails.env.development?
@ -3,4 +3,8 @@ class CsvDownload < ApplicationRecord
belongs_to :user
belongs_to :organisation
def expired?
created_at < 24.hours.ago
end
@ -0,0 +1,7 @@
<% content_for :title, "Download link expired" %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">This link has expired</h1>
</div>