diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-16 04:23:44 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-16 04:23:44 -0700 |
commit | 12a4376ae96f79ec0ba889a70a4390531d1d6ffd (patch) | |
tree | 9f05e6ceefe3962cbe508ab667e0e53ad0635507 /activemodel | |
parent | 8b0262f9535cb9ad2215e5ed672150e2c52cb4b4 (diff) | |
parent | 35c5ccb30cf01028970f157894a77fdf54973567 (diff) | |
download | rails-12a4376ae96f79ec0ba889a70a4390531d1d6ffd.tar.gz rails-12a4376ae96f79ec0ba889a70a4390531d1d6ffd.tar.bz2 rails-12a4376ae96f79ec0ba889a70a4390531d1d6ffd.zip |
Merge pull request #1085 from amatsuda/amo_validator_initializer_cleanup
cleanups on AMo validator initializers
Diffstat (limited to 'activemodel')
-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| |