Sha256: 4097ae3e34bc787f8f7628e1eab2fe7274fe71cdba4b54de0f378b33547d0983
Contents?: true
Size: 603 Bytes
Versions: 9
Compression:
Stored size: 603 Bytes
Contents
# encoding: utf-8 module SexyValidations module Validators class Inclusion def self.validate(model, attribute, value, options) return unless value unless options.is_a?(Hash) options = { :within => options, } end data = case options[:within] when Proc options[:within].call(model) else options[:within] end unless data.include?(value) model.errors.add(attribute, options[:message] || "ungültige Auswahl") end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems