1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Fix mongoid documents with no attributes.

This commit is contained in:
Matthew Schulkind 2013-06-24 22:04:54 -04:00
parent 28c9577cb4
commit 8b2a21ee9b

View file

@ -44,7 +44,7 @@ module AwesomePrint
def awesome_mongoid_document(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
data = object.attributes.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
data = (object.attributes || {}).sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c[0].to_sym] = c[1]
hash
end