I think you should use hirb gem first, which provides a very nice way to print table columns.
If you want to limit the number of lines displayed, you can do:
Model.limit(n)
For instance:
User.limit(5)
You can also specify the fields that you want to display using select :
User.select("name, email").limit(5)
source share