diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-03 11:51:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-03 11:51:06 +0000 |
commit | d0a3aab2e70241f9ce03704c2c87ed7cb2f2e4b6 (patch) | |
tree | 461adb981286d67f3fa2cca563f74c961162eff2 /app/controllers/users_controller.rb | |
parent | ea59d93dc82d9675586c4b2e176fb4b7640e3158 (diff) | |
download | redmine-d0a3aab2e70241f9ce03704c2c87ed7cb2f2e4b6.tar.gz redmine-d0a3aab2e70241f9ce03704c2c87ed7cb2f2e4b6.zip |
Adds a reusable method to render API response on validation failure.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4455 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fef13c7d2..5d80c2937 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -122,8 +122,7 @@ class UsersController < ApplicationController respond_to do |format| format.html { render :action => 'new' } - format.json { render :json => {:errors => @user.errors}, :status => :unprocessable_entity, :layout => false } - format.xml { render :xml => @user.errors, :status => :unprocessable_entity, :layout => false } + format.api { render_validation_errors(@user) } end end end @@ -180,8 +179,7 @@ class UsersController < ApplicationController respond_to do |format| format.html { render :action => :edit } - format.json { render :json => {:errors => @user.errors}, :status => :unprocessable_entity, :layout => false } - format.xml { render :xml => @user.errors, :status => :unprocessable_entity, :layout => false } + format.api { render_validation_errors(@user) } end end rescue ::ActionController::RedirectBackError |