I have the Thumbs_Up gem loaded and the voting is working fine.
I added this code to the posts controller:
def poll_winners
@posts = Post.tally(
{ :at_least => 1,
:limit => 20,
:order => 'vote_count desc'
})
I just can't figure out what to put in the actual view to get it to display.
Is it just <% poll_winners %>
?
EDIT2: Here's the complete error message:
undefined local variable or method `poll_winners' for #<#<Class:0x000000040a4278>:0x007f55806c3360>
*EDIT*Here's my complete posts controller (not sure if it is right):
class PostsController < InheritedResources::Base
def vote_up
begin
current_user.vote_for(@post = Post.find(params[:id]))
redirect_to [@post]
flash[:success] = "You have voted successfully"
rescue ActiveRecord::RecordInvalid
redirect_to [@post]
flash[:error] = "You have already voted"
end
end
def poll_winners
@posts = Post.tally(
{ :at_least => 1,
:at_most => 10000,
:limit => 10,
:order => 'vote_count desc'
})
end
end