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 549057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:08:41+00:00 2026-05-13T11:08:41+00:00

I did a find on some model and got the following >> @addy =>

  • 0

I did a find on some model and got the following

>> @addy
=> [#<Address id: 3, street: "Some Street", houseNumber: nil, created_at: "2010-01-20 06:09:52", updated_at: "2010-01-20 06:09:52", address_id: 16>]

Now how do I retrieve the values? what if i want the street?

@addy.street does not work netiher does @addy[:street]

what if i had a list of @addy’s and wanted to loop through them to show street for each?

  • 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-13T11:08:41+00:00Added an answer on May 13, 2026 at 11:08 am

    @addy.first.street should work, as it is list of Adress classes containing only one member.

    For displaying each street for more adresses in list:

    @addy.each do |address|
      puts address.street
    end
    

    or

    list_of_streets = @addy.map { |address| address.street }
    

    Edit:
    When you have problem identifying what class you have, always check object.class. When you just use object in IRB, then you see output from object.inspect, which doesn’t have to show class name or even can spoof some informations. You can also call object.methods, object.public_methods.

    And remember that in Ruby some class is also an instance (of Class class). You can call @addr.methods to get instance methods and @addr.class.methods to get class methods.

    Edit2:
    In Rails #find can take as first parameter symbol, and if you pass :first of :last, then you’ll get only one object. Same if you pass one integer (id of retrieved object). In other cases you get list as result, even if it contains only one object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found some threads saying this was doable, but did not find specific instructions
Did some googling and couldn't find a clear answer on this. My assumption is
I did some research but all I could find was syncing data core with
I did some research but couldn't find the answer I was looking for so
I did some research but cannot find a definite approval or disapproval. What I
How to install Ldap on windows7 and to configure it?? Did some googling..cant find
I did some research on the topic but could not find anything similar to
I did find some suggestions for this topic but still there are some things
First of all, I've done my research and I did find a bunch of
I am interested in where string literals get allocated/stored. I did find one intriguing

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.