提交 454d820b 编写于 作者: R Rafael Mendonça França

Don't use tap in this case.

The use of tap in this case is very confusing since we are mutating the
return value inside the block
上级 4e9f53f9
......@@ -195,12 +195,14 @@ def validators
def validators_on(*attributes)
options = attributes.extract_options!
attributes.map do |attribute|
validators = attributes.map do |attribute|
_validators[attribute.to_sym]
end.flatten.tap do |validators|
if options[:kind]
validators.select! { |validator| validator.kind == options[:kind] }
end
end.flatten
if options[:kind]
validators.select! { |validator| validator.kind == options[:kind] }
else
validators
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册