Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace map+compact with select

  • Loading branch information...
commit cbf924ef0854c26d0d0340d0b09a26782e0c661d 1 parent 2a9a10f
John Firebaugh authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activemodel/lib/active_model/serialization.rb
View
2  activemodel/lib/active_model/serialization.rb
@@ -76,7 +76,7 @@ def serializable_hash(options = nil)
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
Please sign in to comment.
Something went wrong with that request. Please try again.