Sha256: 1c192b188776cedb4b015a70a40c5a26e535542cb1615770c85ec974c1db6d32

Contents?: true

Size: 233 Bytes

Versions: 68

Compression:

Stored size: 233 Bytes

Contents

class SubsetValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    superset = options[:of]
    rest = value - superset
    record.errors.add(attribute, :subset, options) unless rest.empty?
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
shipit-engine-0.3.1 app/validators/subset_validator.rb
shipit-engine-0.3.0 app/validators/subset_validator.rb
shipit-engine-0.2.3 app/validators/subset_validator.rb
shipit-engine-0.2.2 app/validators/subset_validator.rb
shipit-engine-0.2.1 app/validators/subset_validator.rb
shipit-engine-0.2.0 app/validators/subset_validator.rb
shipit-engine-0.1.0 app/validators/subset_validator.rb
shipit-engine-0.0.1.pre app/validators/subset_validator.rb