only allow users with votes to see their stats
parent
9fcc103e15
commit
36843ed0fe
|
@ -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
|
||||||
|
|
Reference in New Issue