diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-11 19:42:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-11 19:42:12 +0000 |
commit | ec7c512693b9753ac312d678261eb76625c465fe (patch) | |
tree | 354a1b43abbbc3afcad83b7e8a7df0ba04619cad /app | |
parent | 8ab9215ea8df2216ccfacf272804811b05ab82c8 (diff) | |
download | redmine-ec7c512693b9753ac312d678261eb76625c465fe.tar.gz redmine-ec7c512693b9753ac312d678261eb76625c465fe.zip |
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10984 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/custom_fields_controller.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index 59de860cd..8c853df12 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -31,7 +31,7 @@ class CustomFieldsController < ApplicationController end def create - if request.post? and @custom_field.save + if @custom_field.save flash[:notice] = l(:notice_successful_create) call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) redirect_to custom_fields_path(:tab => @custom_field.class.name) @@ -44,7 +44,7 @@ class CustomFieldsController < ApplicationController end def update - if request.put? and @custom_field.update_attributes(params[:custom_field]) + if @custom_field.update_attributes(params[:custom_field]) flash[:notice] = l(:notice_successful_update) call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) redirect_to custom_fields_path(:tab => @custom_field.class.name) @@ -54,10 +54,11 @@ class CustomFieldsController < ApplicationController end def destroy - @custom_field.destroy - redirect_to custom_fields_path(:tab => @custom_field.class.name) - rescue - flash[:error] = l(:error_can_not_delete_custom_field) + begin + @custom_field.destroy + rescue + flash[:error] = l(:error_can_not_delete_custom_field) + end redirect_to custom_fields_path(:tab => @custom_field.class.name) end |