- Replace string comparisons ('1', '0') with ActiveModel::Type::Boolean
- More robust handling of truthy/falsy values
- Follows Rails conventions for type coercion
- HTML forms still send string values, but controller properly converts them
- Follow Rails conventions by nesting sharing params under resource key
- Update form fields: sharing[enabled] → trip[sharing][enabled]
- Update controller to access params[:trip][:sharing]
- Update all request specs to use nested parameters
- Parameters now properly structured as trip[sharing][expiration], etc.
- 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
- Remove unused @is_public_view variable from controller
- Simplify conditionals by leveraging methods that return [] when empty
- Move public view from trips/public_show to shared/trips/show (Rails conventions)
- Refactor trips#update to be HTML-only (remove JSON responses)
- Convert sharing form to use proper Rails form helpers
- Move JS controller to shared/ subdirectory with proper namespacing
- Create RSpec shared examples for Shareable concern to eliminate duplication
- Update request specs to match HTML-only controller behavior
- Apply 'render/redirect ... and return' pattern for early returns
Simplifies architecture by using the existing trips#update route for
sharing settings management instead of a separate route.
## Changes
**Routes**
- Removed: PATCH /trips/:id/sharing → shared/trips#update
- Now uses: PATCH /trips/:id (existing route) with sharing params
**Controllers**
- Shared::TripsController: Simplified to only handle public view (show)
- TripsController: Added update_sharing private method to handle
sharing params when present
**Views**
- Updated JavaScript in _sharing.html.erb to use trip_path with
nested sharing params
**Tests**
- Updated request specs to use trip_path instead of sharing_trip_path
- All params now nested under sharing key
## Benefits
- Cleaner namespace separation (Shared:: only for public access)
- Follows Rails conventions (one update route handles everything)
- Simpler routing structure
- Reduced code duplication
## Backwards Compatibility
This is a breaking change for the sharing API endpoint, but since
this feature was just implemented and hasn't been released yet,
no migration path is needed.