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
This commit is contained in:
Claude 2025-11-07 12:48:14 +00:00
parent cca025a23a
commit a0674585d4
No known key found for this signature in database

View file

@ -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