Add redirect for GET requests to /upload endpoint

Added a redirect handler for users who try to access /upload via GET
request instead of using the form POST. This prevents errors and guides
users to the proper upload form.

Changes:
- Added GET route for /upload that redirects to benefit forms page
- Added redirect_to_benefit_forms action in controller
- Shows info flash message directing users to the upload form

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ken Johnson
2025-12-11 13:25:50 +00:00
parent 705f7508aa
commit bcf1aabd35
2 changed files with 6 additions and 0 deletions
@@ -16,6 +16,11 @@ class BenefitFormsController < ApplicationController
end end
end end
def redirect_to_benefit_forms
flash[:info] = "Please use the upload form below to upload files"
redirect_to user_benefit_forms_path(user_id: current_user.id)
end
def upload def upload
file = params[:benefits][:upload] file = params[:benefits][:upload]
+1
View File
@@ -34,6 +34,7 @@ Railsgoat::Application.routes.draw do
end end
get "download" => "benefit_forms#download" get "download" => "benefit_forms#download"
get "upload" => "benefit_forms#redirect_to_benefit_forms"
post "upload" => "benefit_forms#upload" post "upload" => "benefit_forms#upload"
resources :tutorials do resources :tutorials do