Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modify most wanted query

  • Loading branch information...
commit 5f93681622feda308a24ea7d3175511f48eedd62 1 parent 2f12cf9
@zuhao authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 app/models/ruby_gem.rb
View
6 app/models/ruby_gem.rb
@@ -5,8 +5,10 @@ class RubyGem < ActiveRecord::Base
has_one :fedora_rpm, :dependent => :destroy
has_many :gem_comments, :dependent => :destroy, :order => 'created_at desc'
has_many :dependencies, :as => :package, :dependent => :destroy, :order => 'created_at desc'
- scope :most_wanted, :joins => :gem_comments, :group => 'gem_comments.ruby_gem_id',
- :order => 'count(gem_comments.want_it) desc', :having => 'gem_comments.want_it = "t"'
+ scope :most_wanted, { :joins => 'INNER JOIN gem_comments ON gem_comments.ruby_gem_id = ruby_gems.id',
+ :conditions => 'gem_comments.want_it = "t"',
+ :group => 'ruby_gems.id',
+ :order => 'count(gem_comments.id) desc' }
scope :most_popular, :order => 'downloads desc'
def to_param
Please sign in to comment.
Something went wrong with that request. Please try again.