Skip to content

Instantly share code, notes, and snippets.

@nathany
Created October 17, 2010 21:55
Show Gist options
  • Select an option

  • Save nathany/631342 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

kills self

@fnichol
Copy link
Copy Markdown

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