aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-03 00:17:10 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-03 00:17:10 -0300
commitd56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb (patch)
tree267e748f481c0e091b8635816747bd192a4ab9c5 /activemodel/lib
parent86062005a73589dc4919cfac401ce061f061c6a0 (diff)
downloadrails-d56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb.tar.gz
rails-d56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb.tar.bz2
rails-d56b5dacb1fbaeef9d48d57594b2f1f9c32a21bb.zip
Use the `flat_map` method.
Thanks to @jeremy to teach me this one.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index 4762f39044..243d911f71 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -188,9 +188,9 @@ module ActiveModel
# # #<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.