Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Debadatta Pradhan's Profile

GitHub User: Debadatta

Site: http://debadattapradhan.blogspot.in

Comments by Debadatta Pradhan

Avatar

Hi all

I have a products table with server side response.

But I am getting issue with sorting for comments_count. Because comments_count is not a field in products table .

I am getting PGSql error for undefined column comments_count.

But comments_count is the total number of counts for each product record.

def sort_column
columns = %w[name created_at user_id id category_name comments_count]
columns[params[:iSortCol_0].to_i]
end

How can I solve to order by comments_count ?