Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:42:48+00:00 2026-06-08T08:42:48+00:00

Possible Duplicate: Rails console, how to stop output of return value? Consider this session

  • 0

Possible Duplicate:
Rails console, how to stop output of return value?

Consider this session in IRB:

>> for a in 1..5 do
?>     puts a
>> end
1
2
3
4
5
=> 1..5
>> 

How do I suppress the output => 1..5? This is important if I do this in a Rails console session:

for post in Post.find(:all) do
    if post.submit_time > Time.now
        puts "Corrupted post #{post.id} is from the future"
    end
end

I don’t want all the Posts to be printed as an array at the end. How do I suppress that output?

I am sure there are other ways of doing this, like find_each or a Ruby script but I am more interested in doing this in an interactive session.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:42:49+00:00Added an answer on June 8, 2026 at 8:42 am

    Just add nil to the end of your command. It doesn’t kill irb’s response line, but if you have some large object, it avoids blasting your screen.

    1.9.3p194 :036 > for a in 1..5 do; puts a; end; nil
    1
    2
    3
    4
    5
     => nil 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Ruby 1.9.2 and Rails 3 cannot open rails console I have already
Possible Duplicate: Access a view helper for a model in rails I know this
Possible Duplicate: Rails 3.0 & Ruby 1.9.2rc: Rake commands return 'already initialized constant' &
Possible Duplicate: conditional statement and assigning value in ruby While refactoring some rails code,
Possible Duplicate: Rails 2.3-style plugins and deprecation warnings running task in Heroku I am
Possible Duplicate: Ruby On Rails 3 and Webrick issue $ rails server /Users/Vineeth/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require':
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Rails 2.3-style plugins and deprecation warnings running task in Heroku A few
Possible Duplicate: Rails primary key and object id Very quick question. My server is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.