From dc51f532a4ecd06f6cab6c6958d888979215f6e5 Mon Sep 17 00:00:00 2001 From: Nedim Uka Date: Tue, 22 Apr 2025 08:23:29 +0200 Subject: [PATCH] Redirect to reservation after created notification --- app/controllers/reservations_controller.rb | 4 ++-- app/views/reservations/index.html.erb | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/controllers/reservations_controller.rb b/app/controllers/reservations_controller.rb index 0ef0877..ad76429 100644 --- a/app/controllers/reservations_controller.rb +++ b/app/controllers/reservations_controller.rb @@ -47,7 +47,7 @@ class ReservationsController < ApplicationController assign_customer_to_reservation if @reservation.save - redirect_to @reservation, notice: t('.reservation_created') + redirect_to reservations_url, notice: t('.reservation_created') else @customers = @company.customers render :new, status: :unprocessable_entity @@ -98,7 +98,7 @@ class ReservationsController < ApplicationController # Check if reservation update was successful # (We might ignore customer_updated status for now, or add more complex checks) if reservation_updated - format.html { redirect_to reservation_url(@reservation), notice: t('.reservation_updated') } + format.html { redirect_to reservations_url, notice: t('.reservation_updated') } format.json { render :show, status: :ok, location: @reservation } else @customers = @company.customers # Reload for form diff --git a/app/views/reservations/index.html.erb b/app/views/reservations/index.html.erb index 3f871a8..d957cef 100644 --- a/app/views/reservations/index.html.erb +++ b/app/views/reservations/index.html.erb @@ -2,15 +2,14 @@
- <% if notice.present? %> -

<%= notice %>

- <% end %> - <% content_for :title, "Reservations" %>

Reservations

+ <% if notice.present? %> +

<%= notice %>

+ <% end %>