carpeliam (owner)

Revisions

gist: 14014 Download_button fork
public
Public Clone URL: git://gist.github.com/14014.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
class Specialty < ActiveRecord::Base
  named_scope :all_by_popularity,
    :select => 'specialties.*, count(specialties.id) AS c',
    :joins => :stores,
    :group => 'specialties.id',
    :order => 'c DESC'
end