Skip to content

Commit

Permalink
Use map + flatten here
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Feb 7, 2011
1 parent 0de661d commit 933adce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activemodel/lib/active_model/validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 933adce

Please sign in to comment.