From c98f46d691542baf769bc74e25f808277cd5878b Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sun, 20 Jun 2010 19:30:51 +0000 Subject: Handle unsuccessful destroys in TimelogController. #5700 Contributed by Jan git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3805 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/timelog_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 160c19974..73ff58b82 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -225,8 +225,11 @@ class TimelogController < ApplicationController def destroy (render_404; return) unless @time_entry (render_403; return) unless @time_entry.editable_by?(User.current) - @time_entry.destroy - flash[:notice] = l(:notice_successful_delete) + if @time_entry.destroy && @time_entry.destroyed? + flash[:notice] = l(:notice_successful_delete) + else + flash[:error] = l(:notice_unable_delete_time_entry) + end redirect_to :back rescue ::ActionController::RedirectBackError redirect_to :action => 'details', :project_id => @time_entry.project -- cgit v1.2.3