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.2.31 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.30 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.29 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.28 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.27 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.26 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.25 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.24 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.23 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.22 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.21 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.20 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.19 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.18 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.17 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.16 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.15 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.14 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.13 app/validators/ecom/core/date_range_validator.rb
ecom_core-1.2.12 app/validators/ecom/core/date_range_validator.rb