Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5977 from oscardelben/refactor_serializable_hash

Minor refactor of serializable hash
  • Loading branch information...
commit 217e9c088e07d55007c5f63a56ad5747cf2f646d 2 parents 2aabf8c + a631dd9
@josevalim josevalim authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  activemodel/lib/active_model/serialization.rb
View
3  activemodel/lib/active_model/serialization.rb
@@ -78,8 +78,7 @@ def serializable_hash(options = nil)
hash = {}
attribute_names.each { |n| hash[n] = read_attribute_for_serialization(n) }
- method_names = Array(options[:methods]).select { |n| respond_to?(n) }
- method_names.each { |n| hash[n.to_s] = send(n) }
+ Array(options[:methods]).each { |m| hash[m.to_s] = send(m) if respond_to?(m) }
serializable_add_includes(options) do |association, records, opts|
hash[association.to_s] = if records.is_a?(Enumerable)
Please sign in to comment.
Something went wrong with that request. Please try again.