$LOAD_PATH << '../lib' require 'active_record' require 'mongoid' require 'html_format' Mongo::Logger.logger.level = Logger::INFO Mongoid::Config.connect_to('test') Mongoid::Clients.default.database.drop class User include Mongoid::Document field :name, type: String end ['alice', 'bob', 'carol'].each { |e| User.create!(name: e) } html_format User # => "
_idname
5b34406cf6453f07063d4dd3alice
5b34406cf6453f07063d4dd4bob
5b34406cf6453f07063d4dd5carol
" html_format User.first # => "
_id5b34406cf6453f07063d4dd3
namealice
" html_format User.limit(1) # => "
_idname
5b34406cf6453f07063d4dd3alice
" User.to_html # => "
_idname
5b34406cf6453f07063d4dd3alice
5b34406cf6453f07063d4dd4bob
5b34406cf6453f07063d4dd5carol
" User.first.to_html # => "
_id5b34406cf6453f07063d4dd3
namealice
" User.limit(1).to_html # => "
_idname
5b34406cf6453f07063d4dd3alice
"