1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #5977 from oscardelben/refactor_serializable_hash

Minor refactor of serializable hash
This commit is contained in:
José Valim 2012-04-25 04:46:52 -07:00
commit 217e9c088e

View file

@ -78,8 +78,7 @@ module ActiveModel
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)