diff options
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/validations/length.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations/numericality.rb | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 72735cfb89..d595a5fb43 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -16,7 +16,7 @@ module ActiveModel options[:maximum] -= 1 if range.exclude_end? end - super(options.reverse_merge(:tokenizer => DEFAULT_TOKENIZER)) + super end def check_validity! @@ -36,7 +36,7 @@ module ActiveModel end def validate_each(record, attribute, value) - value = options[:tokenizer].call(value) if value.kind_of?(String) + value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String) CHECKS.each do |key, validity_check| next unless check_value = options[key] diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index ae576462e6..42556c80a9 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -9,10 +9,6 @@ module ActiveModel RESERVED_OPTIONS = CHECKS.keys + [:only_integer] - def initialize(options) - super(options.reverse_merge(:only_integer => false, :allow_nil => false)) - end - def check_validity! keys = CHECKS.keys - [:odd, :even] options.slice(*keys).each do |option, value| |