diff options
| author | Robert | 2017-11-01 19:11:04 +0100 | 
|---|---|---|
| committer | Robert | 2017-11-01 20:31:47 +0100 | 
| commit | 28c086c3ec889e3fca806062dc8378ba5f22dfc2 (patch) | |
| tree | 8c57befca41582f171f452728f014a32b10456b1 /app/models/referential.rb | |
| parent | 13553712a18435f16f449a6d0c6a2ade24038797 (diff) | |
| download | chouette-core-28c086c3ec889e3fca806062dc8378ba5f22dfc2.tar.bz2 | |
Refs: #4802@6h; Replaying former work. To identify spec regression
Step 1: config/locales
Diffstat (limited to 'app/models/referential.rb')
| -rw-r--r-- | app/models/referential.rb | 10 | 
1 files changed, 9 insertions, 1 deletions
| diff --git a/app/models/referential.rb b/app/models/referential.rb index c7b52ddf8..04cdf986d 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -1,4 +1,3 @@ -# coding: utf-8  class Referential < ActiveRecord::Base    include DataFormatEnumerations @@ -28,6 +27,15 @@ class Referential < ActiveRecord::Base    belongs_to :organisation    validates_presence_of :organisation +  validate def validate_consistent_organisation +    return true if workbench_id.nil? +    ids = [workbench.organisation_id, organisation_id] +    return true if ids.first == ids.last +    errors.add(:inconsistent_organisation, +               I18n.t('referentials.errors.inconsistent_organisation', +                      indirect_name: workbench.organisation.name, +                      direct_name: organisation.name)) +  end    belongs_to :line_referential    validates_presence_of :line_referential | 
