Sha256: c2d491bfb53d32cd3b03c0da9274885e5b69cde6934db1b3838c82464f102273

Contents?: true

Size: 438 Bytes

Versions: 35

Compression:

Stored size: 438 Bytes

Contents

module ActiveModel
  module Validations
    class RespondToValidator < EachValidator
      RESERVED_OPTIONS = [:if, :unless]
      def validate_each(record,attribute,value)
        responders = options.dup
        RESERVED_OPTIONS.each do |opt,should_apply| responders.delete(opt) end
        responders.each do |method,dummy|
          record.errors.add(attribute) unless value.respond_to? method
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
activevalidators-6.0.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-5.1.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-5.0.1 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-5.0.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-4.1.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-4.0.3 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-4.0.2 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-4.0.1 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-4.0.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-3.3.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-3.2.0 lib/active_validators/active_model/validations/respond_to_validator.rb
activevalidators-3.1.2 lib/active_model/validations/respond_to_validator.rb
activevalidators-3.1.1 lib/active_model/validations/respond_to_validator.rb
activevalidators-3.0.0 lib/active_model/validations/respond_to_validator.rb
activevalidators-2.1.0 lib/active_model/validations/respond_to_validator.rb
activevalidators-2.0.2 lib/active_model/validations/respond_to_validator.rb
activevalidators-2.0.1 lib/active_model/validations/respond_to_validator.rb
activevalidators-2.0.0 lib/active_model/validations/respond_to_validator.rb
activevalidators-1.9.0 lib/active_model/validations/respond_to_validator.rb
activevalidators-1.8.1 lib/active_model/validations/respond_to_validator.rb