Skip to content

Commit

Permalink
Use the flat_map method.
Browse files Browse the repository at this point in the history
Thanks to @jeremy to teach me this one.
  • Loading branch information
rafaelfranca committed Oct 3, 2012
1 parent 8606200 commit d56b5da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activemodel/lib/active_model/validations.rb
Expand Up @@ -188,9 +188,9 @@ def validators
# # #<ActiveModel::Validations::InclusionValidator:0x007fe603bb8780 @attributes=[:age], @options={:in=>0..99}> # # #<ActiveModel::Validations::InclusionValidator:0x007fe603bb8780 @attributes=[:age], @options={:in=>0..99}>
# # ] # # ]
def validators_on(*attributes) def validators_on(*attributes)
attributes.map do |attribute| attributes.flat_map do |attribute|
_validators[attribute.to_sym] _validators[attribute.to_sym]
end.flatten end
end end


# Returns +true+ if +attribute+ is an attribute method, +false+ otherwise. # Returns +true+ if +attribute+ is an attribute method, +false+ otherwise.
Expand Down

0 comments on commit d56b5da

Please sign in to comment.