diff options
-rw-r--r-- | activemodel/lib/active_model/validations/length.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 6bc928bab7..95a8ca49e9 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -6,7 +6,6 @@ module ActiveModel MESSAGES = { :is => :wrong_length, :minimum => :too_short, :maximum => :too_long }.freeze CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze - DEFAULT_TOKENIZER = lambda { |value| value.split(//) } RESERVED_OPTIONS = [:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long] def initialize(options) @@ -36,7 +35,7 @@ module ActiveModel end def validate_each(record, attribute, value) - value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String) + value = options[:tokenizer].call(value) if value.kind_of?(String) && options[:tokenizer].present? CHECKS.each do |key, validity_check| next unless check_value = options[key] diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 100b48312a..989c7205fa 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -227,7 +227,7 @@ module ActiveSupport #:nodoc: def load_dependency(file) if Dependencies.load? - Dependencies.new_constants_in(Object) { yield }.presence + Dependencies.new_constants_in(Object) { yield } else yield end @@ -236,13 +236,13 @@ module ActiveSupport #:nodoc: raise end - def load(file, *) + def load(file, wrap = false) result = false load_dependency(file) { result = super } result end - def require(file, *) + def require(file) result = false load_dependency(file) { result = super } result |