#671: updated output errors

This commit is contained in:
Vokhmin Alexey V 2012-10-10 21:51:00 +04:00
parent eef640e82c
commit 05d222e9de
1 changed files with 9 additions and 1 deletions

View File

@ -85,7 +85,15 @@ class Api::V1::PlatformsController < Api::V1::BaseController
private
def json_response(message, nullify_id = false)
id = nullify_id ? nil : @platform.id
if nullify_id
errors = @platform.errors.full_messages.join('. ')
if errors.present?
message << '. ' << errors
end
id = nil
else
id = @platform.id
end
{ :platform => {:id => id, :message => message} }.to_json
end