diff options
| -rw-r--r-- | app/controllers/referentials_controller.rb | 12 |
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 |
