Reputation: 8487
I am using the rails console
and I'm trying to loop through an array of objects, and print just one of their properties, say for example, the name
property.
How do I do this?
Upvotes: 0
Views: 734
Reputation: 26
you can use pluck method for fetching attributes.
Model.pluck(:name)
Upvotes: 1