I have a zip file I want to give my users.
But first I need for them to agree to a End User License Agreement
(EULA).
I can’t think of any way to prevent them from going to the download link
and getting the file without agreeing to the End User License Agreement
first.
Any suggestions?
I’ve never had to do this before, but I would try it as follows:
- Store the zip file outside of your public directory. The user
then
must access the file via the controller action you specify.
- Create a controller action somewhere (FileDownloadController?)
that
handles the actual downloading of your file using the
ActionController::Streaming#send_file method.
- Create other controller actions somewhere (EulaController) for
display
and acceptance of your EULA. The acceptance action should
specifically set
some state in the user’s session (or in a cookie, if you want to
remember
that the user accepted the terms between sessions) that indicates
that he
passed this part of the process.
- Go back to the original controller used for file download. Create
a
before_filter that checks for the state you just set before allowing
the
user to execute the download action. If it is not found, the user
should be
redirected to the EULA display page.
Some variation on that process should get you what you want.
HTH.