aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/numericality.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/validations/numericality.rb')
-rw-r--r--activemodel/lib/active_model/validations/numericality.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb
index 9a0a0655de..48e0e5c9f6 100644
--- a/activemodel/lib/active_model/validations/numericality.rb
+++ b/activemodel/lib/active_model/validations/numericality.rb
@@ -1,5 +1,4 @@
module ActiveModel
-
module Validations
class NumericalityValidator < EachValidator # :nodoc:
CHECKS = { greater_than: :>, greater_than_or_equal_to: :>=,
@@ -27,8 +26,6 @@ module ActiveModel
raw_value = value
end
- return if options[:allow_nil] && raw_value.nil?
-
unless is_number?(raw_value)
record.errors.add(attr_name, :not_a_number, filtered_options(raw_value))
return
@@ -99,10 +96,10 @@ module ActiveModel
private
- def record_attribute_changed_in_place?(record, attr_name)
- record.respond_to?(:attribute_changed_in_place?) &&
- record.attribute_changed_in_place?(attr_name.to_s)
- end
+ def record_attribute_changed_in_place?(record, attr_name)
+ record.respond_to?(:attribute_changed_in_place?) &&
+ record.attribute_changed_in_place?(attr_name.to_s)
+ end
end
module HelperMethods