ruby-on-railsrubyirb

How to suppress Rails console/irb outputs


I was testing some DB entries in our production server in Rails Console where almost all the commands were producing a huge number of lines of output and causing the ssh channel to hang.

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


Solution

  • You can append ; nil to your statements.

    Example:

    users = User.all; nil
    

    irb prints the return value of the last executed statement; thus in this case it'll print only nil since nil is the last executed valid statement.