only allow users with votes to see their stats

master
Coleman 2008-10-11 17:37:14 -05:00
parent 9fcc103e15
commit 36843ed0fe
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ class Votes < Application
per_page = 4 per_page = 4
@votes = @user.votes.find :all, :limit => 4, :offset => (@page * 4) @votes = @user.votes.find :all, :limit => 4, :offset => (@page * 4)
@page_count = (@user.votes.size.to_f / per_page.to_f).ceil @page_count = (@user.votes.size.to_f / per_page.to_f).ceil
if @votes.empty?
flash[:notice] = 'You need to vote, first'
redirect url(:new_vote)
end
if request.xhr? if request.xhr?
partial 'votes/stats_for_user' partial 'votes/stats_for_user'
else else