From d56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 3 Oct 2012 00:17:10 -0300 Subject: Use the `flat_map` method. Thanks to @jeremy to teach me this one. --- activemodel/lib/active_model/validations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 4762f39044..243d911f71 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -188,9 +188,9 @@ module ActiveModel # # #0..99}> # # ] def validators_on(*attributes) - attributes.map do |attribute| + attributes.flat_map do |attribute| _validators[attribute.to_sym] - end.flatten + end end # Returns +true+ if +attribute+ is an attribute method, +false+ otherwise. -- cgit v1.2.3