提交 217e9c08 编写于 作者: J José Valim

Merge pull request #5977 from oscardelben/refactor_serializable_hash

Minor refactor of serializable hash
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册