ghtn ghtn - 16 days ago 5
Ruby Question

How to suppress Rails console/irb outputs

I'm stuck with a pretty weird problem.

I was testing some db entries in our production server in Rails Console where almost all the commands were resulting a huge number of o/p lines, due to which the ssh channel was getting hanged :(

Is there a way to suppress the console/irb screenfuls?

Thanks

Answer

You can append ; nil to all your your commands/statements.

Example:

users = User.all; nil

Actually irb prints the (return) value of the last executed statement. Thus in this case it'll print only nil as nil is the last executed valid statement :)

Comments