Skip to content

Commit

Permalink
faster quick reservation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Bartels committed Dec 20, 2023
1 parent 049287b commit 85b2bf4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/reservations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def create
# try to save
patched_params["desk_id"] = desk.id
@reservation = Reservation.new(patched_params)
if @reservation.save
# check if valid first, then save. this way we reduce the amount of transactions with rollbacks
if @reservation.valid?
@reservation.save
redirect_to root_path, notice: "Created new quick reservation."
return
end
Expand Down

0 comments on commit 85b2bf4

Please sign in to comment.