Sha256: 3782f6d99600da841b2e05e88de1edfcf1d753162832b20be4de6b1766a3183a

Contents?: true

Size: 806 Bytes

Versions: 8

Compression:

Stored size: 806 Bytes

Contents

module ActiveModel
  module Validations

    module HelperMethods
      def validates_date(*attr_names)
        timeliness_validation_for attr_names, :date
      end

      def validates_time(*attr_names)
        timeliness_validation_for attr_names, :time
      end

      def validates_datetime(*attr_names)
        timeliness_validation_for attr_names, :datetime
      end

      def timeliness_validation_for(attr_names, type)
        options = _merge_attributes(attr_names).merge(:type => type)
        if respond_to?(:timeliness_validated_attributes)
          self.timeliness_validated_attributes ||= []
          self.timeliness_validated_attributes += (attr_names - self.timeliness_validated_attributes)
        end
        validates_with TimelinessValidator, options
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
validates_timeliness-3.0.13 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.12 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.11 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.10 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.9 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.8 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.7 lib/validates_timeliness/helper_methods.rb
validates_timeliness-3.0.6 lib/validates_timeliness/helper_methods.rb