diff options
Diffstat (limited to 'activemodel/lib/active_model/validations/length.rb')
-rw-r--r-- | activemodel/lib/active_model/validations/length.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 77db437a33..c8a77ad666 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -7,6 +7,7 @@ module ActiveModel 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) if range = (options.delete(:in) || options.delete(:within)) @@ -50,9 +51,8 @@ module ActiveModel next if valid_value - reserved_options = [:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long] record.errors.add(attribute, MESSAGES[key], - options.except(*reserved_options).merge(:count => check_value)) + options.except(*RESERVED_OPTIONS).merge!(:count => check_value)) end end end |