diff options
| author | Alban Peignier | 2017-12-28 12:16:19 +0100 | 
|---|---|---|
| committer | Alban Peignier | 2017-12-28 12:16:19 +0100 | 
| commit | e20ce60629e91c63d75701651c117177ce02aced (patch) | |
| tree | d762e6606360df082a1d6b97308800ac9e4f4de0 /app | |
| parent | d6f6abf41dd8eeb506e8f224ca7e0b1f3f5fab59 (diff) | |
| download | chouette-core-e20ce60629e91c63d75701651c117177ce02aced.tar.bz2 | |
Add log messages when Referential can't be created. Remove useless build_referenial invocation in ReferentialsController#create. Refs #5297
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/referentials_controller.rb | 7 | ||||
| -rw-r--r-- | app/models/referential.rb | 1 | 
2 files changed, 5 insertions, 3 deletions
| diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 9dbd659da..f63abf685 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -14,15 +14,16 @@ class ReferentialsController < ChouetteController    def create      create! do |success, failure| -      build_referenial -        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 } +      failure.html do +        Rails.logger.info "Can't create Referential : #{@referential.errors.inspect}" +        render :new +      end      end    end diff --git a/app/models/referential.rb b/app/models/referential.rb index 122af65a1..8db009ebd 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -282,6 +282,7 @@ class Referential < ActiveRecord::Base    def detect_overlapped_referentials      self.class.where(id: overlapped_referential_ids).each do |referential| +      Rails.logger.info "Referential #{referential.id} #{referential.metadatas.inspect} overlaps #{metadatas.inspect}"        errors.add :metadatas, I18n.t("referentials.errors.overlapped_referential", :referential => referential.name)      end    end | 
