Попробуйте
class User < ActiveRecord::Base
named_scope :your_name,
:select=>" users.*,sum(total_quantity * total_price) as points_spent",
:joins => :orders,
:conditions => ['pay_type = ?', 'points'],
:group ="user_id ",
:order=>'points_spent desc'
end