From db2fd4eb96673842c855fc3ec4cf6dc019b40dee Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 17 Mar 2018 16:53:38 +0100 Subject: [PATCH] When updating an event, user is then redirect to the displayed event. Closes #105 --- app/controllers/events_controller.rb | 2 +- test/controllers/events_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 2a9c7a79..134262d7 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -60,7 +60,7 @@ class EventsController < ApplicationController def update respond_to do |format| if @event.update event_params - format.html { redirect_to :root, notice: t('.ok') } + format.html { redirect_to @event, notice: t('.ok') } format.json { head :no_content } else format.html { render action: 'edit' } diff --git a/test/controllers/events_controller_test.rb b/test/controllers/events_controller_test.rb index caf1a5d7..eaf6faf6 100644 --- a/test/controllers/events_controller_test.rb +++ b/test/controllers/events_controller_test.rb @@ -92,7 +92,7 @@ class EventsControllerTest < ActionDispatch::IntegrationTest } assert_empty assigns(:event).errors.messages - assert_redirected_to :root + assert_redirected_to event_url(@event) end test 'should not update event' do