Display real error

This commit is contained in:
skalimer0 2022-09-15 10:06:57 +02:00 committed by GitHub
parent 03635cf88d
commit 3737eba6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,11 @@ class AdditionalsChangeStatusController < ApplicationController
journal: @issue.current_journal
if !@issue.save || issue_old_status_id == @issue.status_id
flash[:error] = l :error_issue_status_could_not_changed
messages = Array.wrap(@issue).map {|object| object.errors.full_messages}.flatten
if messages.empty?
flash[:error] = l :error_issue_status_could_not_changed
else
flash[:error] = messages.join(', ')
return redirect_to(issue_path(@issue))
end