Cleanup in TimelogController#destroy.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9095 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-03-04 15:24:14 +00:00
parent dc50edae5e
commit 6b47cad8ce
2 changed files with 21 additions and 17 deletions
+6 -2
View File
@@ -507,8 +507,12 @@ class ApplicationController < ActionController::Base
end
# Renders API response on validation failure
def render_validation_errors(object)
@error_messages = object.errors.full_messages
def render_validation_errors(objects)
if objects.is_a?(Array)
@error_messages = objects.map {|object| object.errors.full_messages}.flatten
else
@error_messages = objects.errors.full_messages
end
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => false
end