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.31.0 app/validators/subset_validator.rb
shipit-engine-0.30.0 app/validators/subset_validator.rb
shipit-engine-0.29.0 app/validators/subset_validator.rb
shipit-engine-0.28.1 app/validators/subset_validator.rb
shipit-engine-0.28.0 app/validators/subset_validator.rb
shipit-engine-0.27.1 app/validators/subset_validator.rb
shipit-engine-0.27.0 app/validators/subset_validator.rb
shipit-engine-0.26.0 app/validators/subset_validator.rb
shipit-engine-0.25.1 app/validators/subset_validator.rb
shipit-engine-0.25.0 app/validators/subset_validator.rb
shipit-engine-0.24.0 app/validators/subset_validator.rb
shipit-engine-0.23.1 app/validators/subset_validator.rb
shipit-engine-0.23.0 app/validators/subset_validator.rb
shipit-engine-0.22.0 app/validators/subset_validator.rb
shipit-engine-0.21.0 app/validators/subset_validator.rb
shipit-engine-0.20.1 app/validators/subset_validator.rb
shipit-engine-0.20.0 app/validators/subset_validator.rb
shipit-engine-0.19.0 app/validators/subset_validator.rb
shipit-engine-0.18.1 app/validators/subset_validator.rb
shipit-engine-0.18.0 app/validators/subset_validator.rb