Say I have this:
[
{
:id => 34,
:votes_count => 3
},
{
:id => 2,
:votes_count => 0
},
]
How do I get the index based on id? What I want to do is return 0 when I search for id: 34, and 1 when I search for id: 2. What is the most efficient way?
You can pass a block to
#index: