order_by fixNum, integer… mongoid

I have an object with attribute impressionist_count. impressionist_count is a Fixnum.

# => `20`, `1000`, `26`, etc.

I want to sort all my objects in descending order, but it does not work, something like:

Objects.order_by(:impressionist_count, :desc)

I don't know what I am doing wrong. How can I fix this code?


Use .desc():


Or you can use .order_by() if you wrap using arrays like this:

Objects.order_by([[:impressionist_count, :desc]])

Need Your Help

HtmlViewService in OBIEE Web Service API is not rendering report (it's only showing spinning loader)

java web-services wsdl obiee

I have a Java application that leverages the OBIEE Web Service API to consume data from the BI Server. I am able to XMLViewService and the WebCatalogService just fine, but I can't quite get the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.