0

When I manage variables from heroku's console, the console spits out the details of variables. The output is especially cumbersome when they're ActiveRecords. How do I suppress that output? It clutters my terminal. I tried some of the obvious answers on StackOverflow, such as setting Rails.logger to nil, and nothing seems to work.

philipkd
  • 910
  • 7
  • 20
  • 1
    I think this is what you want: https://stackoverflow.com/questions/13284277/stop-rails-console-from-printing-out-the-object-at-the-end-of-a-loop , which just means you add another expression because only the last is printed, like `Post.last; 0`, but I would also suggest you look into `awesome_print` and `table_print` gems, which make the output a lot more readable. – Unixmonkey Apr 09 '20 at 23:28
  • Thanks for the link. The `conf.echo = false` was the answer I was looking for. – philipkd Apr 11 '20 at 00:22

1 Answers1

3

If it's ActiveRecord logging that you're after, you can silence.

ActiveRecord::Base.logger = nil

Or wrap your input,

ActiveRecord::Base.logger.silence { ... }

If you're setting variables, you can just

@thing = Thing.last; 0

Josh Brody
  • 5,153
  • 1
  • 14
  • 25