After upgrading to Rails 6.1.7.2 and Ruby 3.1.2, the way ActiveRecords are displayed in the output of the rails console is really annoying me. Basically, each record's attributes and values are displayed one line at a time. For example, Car.first outputs:
3.1.2 :001 > Car.first
Car Load (7.0ms) SELECT "cars".* FROM "cars" ORDER BY "cars"."id" ASC LIMIT $1 [["LIMIT", 1]]
=>
#<Car:0x000000010e8d6fd0
id: 13,
user_id: 1,
track_id: 7,
car_number: "979754",
car_initial: "rofl",
door_type: "Sealsafe",
car_type: "Tri",
shipper: "GMOT",
pretrip_only: false,
date_created: Sat, 16 Jul 2022 21:03:07.246098000 UTC +00:00,
date_updated: nil,
updated_by: nil,
scoring_inspector_id: "65",
scoring_rack_score_job_code_6036_why_made: "21",
scoring_rack_score_stenciling_job_code_6037_why_made: "09",
scoring_roof: "3",
scoring_side_screens: "3",
scoring_shear_bay_exterior: "4",
scoring_exterior_door: "4",
scoring_top_of_deck: "4",
scoring_underside_of_deck: "4",
scoring_side_posts_interior: "3",
scoring_shear_bay_interior: "1",
scoring_door_interior: "3",
created_at: Wed, 20 Jul 2022 21:56:24.987715000 UTC +00:00,
updated_at: Tue, 26 Jul 2022 21:03:07.290183000 UTC +00:00,
expressyard_id: 1860065,
last_expressyard_sync_attempt_error: "",
last_expressyard_sync_attempt_params: nil,
client_created_at: nil>
This forces me to scroll way too much. Before I upgraded, I was using 2.7.3, and the entire record would be printed on one line, but my IDE (RubyMine) would wrap the text. How can I go back to the 2.7.3 style with 3.1.2?
https://github.com/rails/rails/pull/15172 introduced the new behavior, but the "verbose" style is becoming much more in-vogue these days so it may be a losing battle on your end to try and fight it. I'd personally suggest you give the value-per-line format more time, and it may grow on you!
But perhaps you could use AwesomePrint, or the more-maintained fork AmazingPrint, to customize your output and reach true debugging Nirvana.
This produces output like:
As compared to the prior: