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|
        hash[c[0].to_sym] = c[1]
        hash
      end
      data = { errors: object.errors, attributes: data } if !object.errors.empty?
      "#{object} #{awesome_hash(data)}"
    end
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|
        hash[c[0].to_sym] = c[1]
        hash
      end
      data = { errors: object.errors, attributes: data } if !object.errors.empty?
      "#{object} #{awesome_hash(data)}"
    end
Format Mongoid Document object.
------------------------------------------------------------------------------