aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui2017-12-20 14:24:02 +0100
committerAlban Peignier2017-12-28 11:34:45 +0100
commit685e834bb96fa0c3aea77aed48770b8577d74c7e (patch)
treea072ed804bcff53f06eb4085589bc07184ce5e93
parent9f9442ef993083d84689c175fe6f5d45acbd5d21 (diff)
downloadchouette-core-685e834bb96fa0c3aea77aed48770b8577d74c7e.tar.bz2
Fix referential create redirect when invalid
Refs #5297
-rw-r--r--app/controllers/referentials_controller.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 40e8264ce..9dbd659da 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -13,14 +13,16 @@ class ReferentialsController < ChouetteController
end
def create
- create! do |format|
+ create! do |success, failure|
build_referenial
- if !!@referential.created_from_id
- flash[:notice] = t('notice.referentials.duplicate')
-
- format.html { redirect_to workbench_path(@referential.workbench) }
+ success.html do
+ if @referential.created_from_id.present?
+ flash[:notice] = t('notice.referentials.duplicate')
+ redirect_to workbench_path(@referential.workbench)
+ end
end
+ failure.html { render :new }
end
end