Fellow Stranger
Fellow Stranger

Reputation: 34013

Display objects in collections one per each line in console

If I do User.where(active: false) in the Rails console, the result is hard to parse.

Is there any trick without iteration (besides gems) to output each value/object one per line?

Upvotes: 3

Views: 438

Answers (1)

RAJ
RAJ

Reputation: 9747

As part of my comment, I am adding an answer here so that other programmers can get help.

You can use pp while using rails console to get presentable print. E.g.:

pp User.where(active: false)

It will print every object on a new line.

Upvotes: 6

Related Questions