Lighthouse has a new layout.
Prefer the old one? Return to the old layout,
and switch back any time from the link at the top of each page.
This project is archived and is in readonly mode.
ActiveRecord::Base should be pretty-printable
#6498
Passing an ActiveRecord::Base instance (or any structure
containing an activerecord - array, hash, etc) to the PP library's
#pp method should result in a nicely-formatted, multi-line output
of the record and its attributes. Instead, we get the single-line
result of the #inspect method.
The attached #pretty_print method outputs a separated list
(using PP's #seplist method) of each record attribute and its
value. It's based on the default object pretty-printer built into
PP, which outputs each instance variable and its value, but this
instead outputs each attribute of the record and its value. The
value is passed through pp so that if it is a serialized array or
hash or whatever, that may be indented and split across multiple
lines of its own.