lib/active_model/validations/numericality.rb in activemodel-5.1.1 vs lib/active_model/validations/numericality.rb in activemodel-5.1.2.rc1
- old
+ new
@@ -34,10 +34,12 @@
if allow_only_integer?(record) && !is_integer?(raw_value)
record.errors.add(attr_name, :not_an_integer, filtered_options(raw_value))
return
end
- unless raw_value.is_a?(Numeric)
+ if raw_value.is_a?(Numeric)
+ value = raw_value
+ else
value = parse_raw_value_as_a_number(raw_value)
end
options.slice(*CHECKS.keys).each do |option, option_value|
case option