title: Searching array of objects for item in Ruby
body: <p>I am trying to search through an array of objects for a value, but am having trouble getting the find_index to work. In my code below, I am trying to search for the name (joseph) in the array. Is this the best way? I want to return that object after I search and find it.</p>
  
  <pre><code>name = "joseph"
  
  array = [{"login":"joseph","id":4,"url":"localhost/joe","description":null},
  {"login":"billy","id":10,"url":"localhost/billy","description":null}]
  
  arrayItem = array.find_index {|item| item.login == name}
  
  puts arrayItem
  </code></pre>