Method: Sequel::Plugins::ValidationHelpers::InstanceMethods#validates_max_value

Defined in:
lib/sequel/plugins/validation_helpers.rb

#validates_max_value(max, atts, opts = OPTS) ⇒ Object

Check that the attribute values are not greater that the given maximum value. Does not perform validation if attribute value is nil. You should only call this if you have checked the attribute value has the expected type.



153
154
155
156
157
# File 'lib/sequel/plugins/validation_helpers.rb', line 153

def validates_max_value(max, atts, opts=OPTS)
  validatable_attributes_for_type(:max_value, atts, opts) do |a,v,m|
    validation_error_message(m, max) if !v.nil? && v > max
  end
end