You would likely want to do this in the show
method in your controller, as that will call a specific Ranking
:
class RankingController < ApplicationController
def index
@rankings = Rate.find(:all)
end
def show
@ranking = Rate.where(:rateable_id => params[:id])
end
end
Then, in your show
view, you could use count
to get the total number of Rate
records returned against unique rater_id
values:
@ranking.map(&:rater_id).uniq.count