I know that Person.find(:all) returns an array of Person objects but is there somehow I can just get ‘name’ property of all people in the Person table?
Something like
Person.find(:all).names
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Use :select to retrieve only specific attributes.
Would give you person objects that only have the name attribute initialized. Then you can map/collect that attribute to get the array of names.