diff options
| author | Zog | 2018-04-18 13:19:18 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-27 11:17:19 +0200 | 
| commit | f7fe4c24e29ceb517abdda66899952a5d6aa73bf (patch) | |
| tree | 7fdd8323e8e5a0189771976878310167b6cdac49 /app/models/clean_up.rb | |
| parent | 0046e5a01cb08c10118b01c50f3c52d159854ef0 (diff) | |
| download | chouette-core-f7fe4c24e29ceb517abdda66899952a5d6aa73bf.tar.bz2 | |
Refs #6572; New Referential#Show for noredy referentials
Diffstat (limited to 'app/models/clean_up.rb')
| -rw-r--r-- | app/models/clean_up.rb | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb index ca4f6312b..0f73e07b2 100644 --- a/app/models/clean_up.rb +++ b/app/models/clean_up.rb @@ -12,6 +12,10 @@ class CleanUp < ApplicationModel    validate :end_date_must_be_greater_that_begin_date    after_commit :perform_cleanup, :on => :create +  scope :for_referential, ->(referential) do +    where(referential_id: referential.id) +  end +    def end_date_must_be_greater_that_begin_date      if self.end_date && self.date_type == 'between' && self.begin_date >= self.end_date        errors.add(:base, I18n.t('activerecord.errors.models.clean_up.invalid_period')) | 
