Sha256: 6ce56de972d7227beb68235aeafd2b5a03a7d6c2857020f821bc7eadfb02c100

Contents?: true

Size: 307 Bytes

Versions: 40

Compression:

Stored size: 307 Bytes

Contents

module Ecom
  module Core
    class DateRangeValidator < ActiveModel::Validator
      def validate(record)
        return unless record.start_date && record.end_date && record.start_date > record.end_date

        record.errors.add(:base, 'End date cannot be before start date')
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ecom_core-1.3.14 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.13 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.12 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.11 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.10 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.9 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.8 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.7 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.6 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.5 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.4 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.3 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.2 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.1 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.3.0 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.36 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.35 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.34 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.33 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.32 app/validators/ecom/core/date_range_validator.rb