Making the rails console output a little more pretty
Also you could use this incredible gem:
Awesome Print
If you don't want to use a gem, here's the low rent version:
puts User.all.to_yaml
A bit more elegant shorthand:
y User.all
I've been using pp
. The pp stands for "pretty print." No Gem required.
On rails console try doing this:
pp User.all
You'll get each attributes and their value in the record display in a row instead a bundle of them if you simply do User.all.
Here's the documentation:
https://ruby-doc.org/stdlib-2.1.0/libdoc/pp/rdoc/PP.html
I am using Rails 5.1.3 and ruby 2.4.1p111 and it came already installed in my project. If this don't work, I imagine you have to do require 'pp'
.
I hope this helps.