Consider the below situation
I have a database table as below
user_id user_rank
------------------
22 10
32 9
43 7
31 6
and i have a JSON Object with the user id like (other nodes in json are hidden for simplicity, consider this response is from an api)
{"user_id":[31,22,43,32]}
now, how do i sort the JSON result based on the rank of a user_id in database and produce a
result like
{"user_id":[22,32,43,31]}
is there anything like LINQ in rails, so that i can save the json object values in it,
and make join between the object and database table to obtain the sorted json?
If you have user ids in json then :
Hope that help.