Permalink
Browse files

Use the `flat_map` method.

Thanks to @jeremy to teach me this one.
  • Loading branch information...
1 parent 8606200 commit d56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb @rafaelfranca rafaelfranca committed Oct 3, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 activemodel/lib/active_model/validations.rb
@@ -188,9 +188,9 @@ def validators
# # #<ActiveModel::Validations::InclusionValidator:0x007fe603bb8780 @attributes=[:age], @options={:in=>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.

0 comments on commit d56b5da

Please sign in to comment.