From 933adce8f45b41a5a6b6bb31ba9d6fb5188f4a35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 7 Feb 2011 19:15:06 -0200 Subject: Use map + flatten here --- activemodel/lib/active_model/validations.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activemodel') diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index a0f90452b3..efd071fedc 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -147,9 +147,9 @@ module ActiveModel # List all validators that being used to validate a specific attribute. def validators_on(*attributes) - attributes.inject([]) do |all, attribute| - all |= _validators[attribute.to_sym] || [] - end + attributes.map do |attribute| + _validators[attribute.to_sym] + end.flatten end # Check if method is an attribute method or not. -- cgit v1.2.3