Skip to content
Browse files

Use map + flatten here

  • Loading branch information...
1 parent 0de661d commit 933adce8f45b41a5a6b6bb31ba9d6fb5188f4a35 @spastorino spastorino committed Feb 7, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 activemodel/lib/active_model/validations.rb
View
6 activemodel/lib/active_model/validations.rb
@@ -147,9 +147,9 @@ def validators
# 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.

0 comments on commit 933adce

Please sign in to comment.
Something went wrong with that request. Please try again.