Skip to content

Update app/controllers/votes_controller.rb#2

Open
gswaroop-g1 wants to merge 1 commit into
shobhitic:masterfrom
gswaroop-g1:patch-2
Open

Update app/controllers/votes_controller.rb#2
gswaroop-g1 wants to merge 1 commit into
shobhitic:masterfrom
gswaroop-g1:patch-2

Conversation

@gswaroop-g1

Copy link
Copy Markdown
Contributor

I can still cast vote without logging in!!

@vote = Vote.new
@vote = Vote.new if current_user !=nil
choice = Choice.find(params[:choice_id])
@vote.choice = choice

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will give a null pointer exception here if current_user is nil. Need to make a full if block where results are shown directly if logged out user is trying to vote.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn. Missed this flex!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants