aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorJohn Firebaugh <john_firebaugh@us.ibm.com>2011-02-21 16:30:33 -0800
committerJohn Firebaugh <john_firebaugh@us.ibm.com>2011-07-17 11:34:06 -0700
commitcbf924ef0854c26d0d0340d0b09a26782e0c661d (patch)
treeef4d1bcf26735ffad470436b03e0c81db7debe1a /activemodel
parent2a9a10f5e3d4d8fc607606e700d1fd2dfec4eda2 (diff)
downloadrails-cbf924ef0854c26d0d0340d0b09a26782e0c661d.tar.gz
rails-cbf924ef0854c26d0d0340d0b09a26782e0c661d.tar.bz2
rails-cbf924ef0854c26d0d0340d0b09a26782e0c661d.zip
Replace map+compact with select
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/serialization.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb
index 78516608fd..0b4067257e 100644
--- a/activemodel/lib/active_model/serialization.rb
+++ b/activemodel/lib/active_model/serialization.rb
@@ -76,7 +76,7 @@ module ActiveModel
attribute_names -= Array.wrap(except).map(&:to_s)
end
- method_names = Array.wrap(options[:methods]).map { |n| n if respond_to?(n.to_s) }.compact
+ method_names = Array.wrap(options[:methods]).select { |n| respond_to?(n) }
Hash[(attribute_names + method_names).map { |n| [n, send(n)] }]
end
end