From a0674585d48a31615eea0ffd325d636459dbb70b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 12:48:14 +0000 Subject: [PATCH] Fix: Add early return for sharing-only updates - When only updating sharing settings, return immediately after handling - Prevents ParameterMissing error when trip params are not present - Sharing updates don't require trip model params - Follows Rails best practice of 'redirect ... and return' pattern --- app/controllers/trips_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index bc3f5786..abb9e907 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -39,8 +39,13 @@ class TripsController < ApplicationController end def update - handle_sharing_update if params[:sharing] + # Handle sharing settings update + if params[:sharing] + handle_sharing_update + redirect_to @trip, notice: 'Trip was successfully updated.', status: :see_other and return + end + # Handle regular trip update if @trip.update(trip_params) redirect_to @trip, notice: 'Trip was successfully updated.', status: :see_other else