$LOAD_PATH << '../lib' require 'active_record' require 'html_format' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users do |t| t.string :name end end class User < ActiveRecord::Base end ['alice', 'bob', 'carol'].each { |e| User.create!(name: e) } html_format User # => "
idname
1alice
2bob
3carol
" html_format User.first # => "
id1
namealice
" html_format User.limit(1) # => "
idname
1alice
" html_format ActiveRecord::Base.connection.select_all('SELECT * FROM users') # => "
idname
1alice
2bob
3carol
" User.to_html # => "
idname
1alice
2bob
3carol
" User.first.to_html # => "
id1
namealice
" User.limit(1).to_html # => "
idname
1alice
" ActiveRecord::Base.connection.select_all('SELECT * FROM users').to_html # => "
idname
1alice
2bob
3carol
"