Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nathany
Created October 17, 2010 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathany/631342 to your computer and use it in GitHub Desktop.
Save nathany/631342 to your computer and use it in GitHub Desktop.
I'm sure glad I'm using an ORM!
scope :ranked, select('rubygems.name, rubygem_id,
COUNT(distinct machine_id) as machine_count,
COUNT(distinct platform_id) as platform_count,
GROUP_CONCAT(version_list) as version_list').
joins(:rubygem).group(:rubygem_id).
order('machine_count DESC, platform_count DESC, rubygems.name')
@darkhelmet
Copy link

kills self

@fnichol
Copy link

fnichol commented Oct 18, 2010

Dear god, that's in our app? Ha!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment