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?
:id.ordered by votes desc(which is the result set above). Essentially I will be callingThing.find(123).rank # => 2