select-your-own-seat

Expand History Expand History
Collapse History Collapse History

Unselect a Seat from the <dialog>

When viewing the details for a Seat that is already included in the visitor’s Cart, present them with a button to remove it.

To determine whether or not the visitor has added a seat, check if the Seat record’s id is in the list of the Cart record’s selected seats (accessed via the has_many :seats-generated seats_id method).

DELETE request routing

In order to support the removal of a Seat without looking up the intermediary SeatSelection record, utilize the previously-declared singular resource :seat_selection route declaration.

As previously stated, instead of routing DELETE /seats/:seat_id/selections/:id requests to the selections#destroy controller action, route DELETE /seats/:seat_id/selections requests.

In the controller action, the correct SeatSelection record can be determined based on the context provided by the Current.cart and the params[:seat_id].

Desktop

unselect from dialog