FIX: editing a post wasn't showing error messages from the server

This commit is contained in:
Régis Hanol
2015-03-19 12:22:56 +01:00
parent b071bd3c7c
commit df3b1f6968
21 changed files with 113 additions and 117 deletions

View File

@ -316,9 +316,7 @@ class ApplicationController < ActionController::Base
# type - a machine-readable description of the error
# status - HTTP status code to return
def render_json_error(obj, opts={})
if opts.is_a? Fixnum
opts = {status: opts}
end
opts = { status: opts } if opts.is_a?(Fixnum)
render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422
end