Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you grab a key/value pair from an array of hashes in ruby?
    text
    copied!<p>I have an array of hashes (or atleast I think they are hashes) and I need to pull out the ID for each of them. I'm sure ruby has some quick way of doing this ... I just can't figure it out. </p> <p>I don't want to iterate through the arrays and build a new one.</p> <pre><code>[ [ { "bio": "I am a tech geek who loves starting up companies. While I was in college, I founded Squeeze My Tees", "business_name": "Rounded Development", "city": "", "created_at": "2012-04-22T18:07:44Z", "first_name": "Brian", "id": 1, "industry": "Entertainment", "last_name": "Weinreich", "lat": null }, { "access_token": null, "bio": null, "business_name": null, "city": null, "created_at": "2012-04-23T13:56:35Z", "email": "test@jambo.com", "first_name": "asdad", "id": 2, "industry": null, "last_name": "ddfs", "lat": null, "linkedin_id": null, "linkedin_url": null, "lng": null, "position": null, "professional_headline": null, "state": null, "street": null, "updated_at": "2012-04-23T13:56:35Z" }, { "access_token": null, "bio": null, "business_name": null, "city": null, "created_at": "2012-04-23T13:56:39Z", "email": "tesasdat@jambo.com", "first_name": "fdsd", "id": 3, "industry": null, "last_name": "asdgw", "lat": null, "linkedin_id": null, "linkedin_url": null, "lng": null, "position": null, "professional_headline": null, "state": null, "street": null, "updated_at": "2012-04-23T13:56:39Z" }, { "access_token": null, "bio": null, "business_name": null, "city": null, "created_at": "2012-04-23T13:56:44Z", "email": "asdsad@jambo.com", "first_name": "ewtrwef", "id": 4, "industry": null, "last_name": "dfd", "lat": null, "linkedin_id": null, "linkedin_url": null, "lng": null, "position": null, "professional_headline": null, "state": null, "street": null, "updated_at": "2012-04-23T13:56:44Z" } ] ] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload