RailsCasts Pro episodes are now free!

Learn more or hide this

Debadatta Pradhan's Profile

GitHub User: Debadatta

Site: http://debadattapradhan.blogspot.in

Comments by Debadatta Pradhan


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]

How can I solve to order by comments_count ?