Reputation: 783
I have the following code which retrieves the count of the following query:
<% @count = Model.find(:all, :conditions =>
{:action => actions, :controller => tempController}).count %>
I'm just wondering how I get this query to order by the count retrieved going from highest to lowest.
Upvotes: 1
Views: 102
Reputation: 11876
Calling Model from views is just against the MVC. This is the wrong way
<% @count = Model.where({:action => actions,
:controller => tempController}).order("column_name").count %>
Upvotes: 2