mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #1085 from amatsuda/amo_validator_initializer_cleanup
cleanups on AMo validator initializers
This commit is contained in:
commit
12a4376ae9
2 changed files with 2 additions and 6 deletions
|
@ -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]
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in a new issue