ruby on rails - Mongoid sorting on custom method -
I have an object called 'Choice' in my model, which will give the total number of choices for the object. Now I want to sort this model on the basis of overall choice. How can we achieve it in Mongoed?
Now this is a problem. You can not do that which mongoid using silent order objects based on their fields Now if you save 'likes' for every object in the field, well, this is straightforward:
Model.desc (: like) If not, you have to use it, which is more complicated like this for a simple matter (of my limited perspective), but of course I Your app does not know, so maybe it compensates.
Comments
Post a Comment