diff options
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/serialization.rb | 2 |
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 |