Fix NoMethodError: undefined method `default_order' for ActiveRecord::Relation

This commit is contained in:
Vladimir Sharshov 2012-02-29 19:10:01 +04:00
parent b20c533e6b
commit 05eac4918f
1 changed files with 2 additions and 2 deletions

View File

@ -19,10 +19,10 @@ class CategoriesController < ApplicationController
if @platform if @platform
@categories = Category.select('categories.id, categories.name, categories.ancestry, count(projects.id) projects_count'). @categories = Category.select('categories.id, categories.name, categories.ancestry, count(projects.id) projects_count').
joins(:projects => :repositories).where('repositories.platform_id = ?', @platform.id). joins(:projects => :repositories).where('repositories.platform_id = ?', @platform.id).
having('count(projects.id) > 0').group('categories.id, categories.name, categories.ancestry, projects_count').default_order having('count(projects.id) > 0').group('categories.id, categories.name, categories.ancestry, projects_count')
render 'index2' render 'index2'
else else
@categories = Category.default_order.paginate(:page => params[:page]) @categories = Category.paginate(:page => params[:page])
end end
end end