From 36843ed0febed36a46abc93a3e4803af111ec80c Mon Sep 17 00:00:00 2001 From: Coleman Date: Sat, 11 Oct 2008 17:37:14 -0500 Subject: [PATCH] only allow users with votes to see their stats --- app/controllers/votes.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/votes.rb b/app/controllers/votes.rb index 64bbb29..6f0d1b0 100644 --- a/app/controllers/votes.rb +++ b/app/controllers/votes.rb @@ -6,6 +6,10 @@ class Votes < Application per_page = 4 @votes = @user.votes.find :all, :limit => 4, :offset => (@page * 4) @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? partial 'votes/stats_for_user' else