lib/acts_as_rateable.rb
# Returns the top rated records, ordered by their average rating.
# You can use the usual finder parameters to narrow down the records
# to return.
# The finder limits the number of returned records to 20 by default.
# Specify :limit to change it.
Returns the top rated records, ordered by their average rating.
You can use the usual finder parameters to narrow down the records
to return.
The finder limits the number of returned records to 20 by default.
Specify :limit to change it.
Returns the top rated records ordered by their average rating . You can use the usual finder parameters to narrow down the records to return . The finder limits the number of returned records to 20 by default . Specify : limit to change it .
def find_top_rated(params = {})
          find_params = params.merge(:include => :rating)
          find_params[:order] = ['ratings.average_rating DESC', find_params.delete(:order)].compact.join(", ")
          find_params[:limit] = 20 unless find_params.key?(:limit)
          find(:all, find_params)
        end
def find_top_rated ( params = { } ) find_params = params . merge ( :include => :rating ) find_params [ :order ] = [ 'ratings.average_rating DESC' , find_params . delete ( :order ) ] . compact . join ( ", " ) find_params [ :limit ] = 20 unless find_params . key? ( :limit ) find ( :all , find_params ) end
Returns the top rated records, ordered by their average rating.
Returns the top rated records ordered by their average rating .
params