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

  • Home
  • SEARCH
  • 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 769851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:24:14+00:00 2026-05-14T18:24:14+00:00

I am working with the rails console, and some models. I am running things

  • 0

I am working with the rails console, and some models. I am running things like:

Model.find(:all).each do |x| p x.name end

which is nice, this lets me see all the values of a specific column, but after it prints those lines, it prints out the whole model.

Why does it do this? How can I stop it?

  • 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-05-14T18:24:15+00:00Added an answer on May 14, 2026 at 6:24 pm

    Console always prints the return value of the command. And the return value for .each is the initial array.

    So you either return the value you need:

    Model.find(:all).map{ |x| x.name }
    

    Or prevent output, returning something like nil:

    Model.find(:all).each{ |x| p x.name }; nil
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with Rails fixtures for testing my rails application. It is all
I'm working on a Rails app and am looking to include some functionality from
I'm working on a Rails web application, and it's currently being used by some
I am working on a rails application (I have some experience with rails). But,
I am working with rails 3 and cucumber, all is going well except for
I'm working on a rails app that has an IPv6 model. I'm storing the
I am working on rails project and I am trying to get exceptions to
I am working on a Rails application that needs to handle dates and times
I am working on a rails project. Using the tag observe_field, I am taking
I'm working on a rails app that has a whole bunch of before filters

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.