Module: FirstLevelObjectValidations
- Extended by:
- ActiveSupport::Concern
- Included in:
- Concept::Base
- Defined in:
- app/models/concerns/first_level_object_validations.rb
Overview
Validations for both concepts and labels
Instance Method Summary collapse
Instance Method Details
#distinct_versions ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/concerns/first_level_object_validations.rb', line 17 def distinct_versions query = self.class.by_origin(origin) existing_total = query.count if existing_total >= 2 errors.add :base, I18n.t('txt.models.concept.version_error', origin: origin) elsif existing_total == 1 unless (query.published.count == 0 && published?) or (query.published.count == 1 && !published?) errors.add :base, I18n.t('txt.models.concept.version_error', origin: origin) end end end |