Skip to content

Commit be30adb

Browse files
committed
Redirect after voting even if no referer is set
1 parent e731074 commit be30adb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/controllers/voting_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
class VotingController < ApplicationController
22
def vote
33
if !user_signed_in? || current_user.votes.where(votable_id: nil).count < 1
4-
redirect_to :back
4+
redirect_to community_voting_path
55
return
66
end
77

88
votable = Votable.find(params[:id])
99
if votable.nil?
10-
redirect_to :back
10+
redirect_to community_voting_path
1111
return
1212
end
1313

1414
vote_to_cast = current_user.votes.where(votable_id: nil).first
1515
vote_to_cast.update votable_id: votable.id
16-
redirect_to :back, notice: "You voted for #{votable.name} successfully!"
16+
redirect_to community_voting_path, notice: "You voted for #{votable.name} successfully!"
1717
end
1818
end

0 commit comments

Comments
 (0)