1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove argument that is accessible as attribute

This commit is contained in:
Carlos Antonio da Silva 2013-11-15 01:00:53 -02:00
parent b8c6c08452
commit 61fef76106

View file

@ -17,8 +17,8 @@ module ActiveModel
raise ArgumentError, "Either :with or :without must be supplied (but not both)"
end
check_options_validity(options, :with)
check_options_validity(options, :without)
check_options_validity :with
check_options_validity :without
end
private
@ -37,7 +37,7 @@ module ActiveModel
source.start_with?("^") || (source.end_with?("$") && !source.end_with?("\\$"))
end
def check_options_validity(options, name)
def check_options_validity(name)
option = options[name]
if option && !option.is_a?(Regexp) && !option.respond_to?(:call)
raise ArgumentError, "A regular expression or a proc or lambda must be supplied as :#{name}"