tinyforms/app/controllers/file_uploads_controller.rb
Michael Bumann 73c184a4a0 Use secure token to create attachment links
The link is public but protected by a secure token.

This extends the activesupport Attachment model to automatically
generate a token
2020-04-12 23:47:56 +02:00

9 lines
305 B
Ruby

class FileUploadsController < ApplicationController
def show
@form = Form.find_by!(token: params[:form_id])
@submission = @form.submissions.find(params[:submission_id])
@file_upload = @submission.files_attachments.find_by!(token: params[:id])
redirect_to url_for(@file_upload)
end
end