aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-16 04:23:44 -0700
committerJosé Valim <jose.valim@gmail.com>2011-05-16 04:23:44 -0700
commit12a4376ae96f79ec0ba889a70a4390531d1d6ffd (patch)
tree9f05e6ceefe3962cbe508ab667e0e53ad0635507
parent8b0262f9535cb9ad2215e5ed672150e2c52cb4b4 (diff)
parent35c5ccb30cf01028970f157894a77fdf54973567 (diff)
downloadrails-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
-rw-r--r--activemodel/lib/active_model/validations/length.rb4
-rw-r--r--activemodel/lib/active_model/validations/numericality.rb4
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|