Created
October 31, 2014 23:40
-
-
Save bchadfield/8b19b55d03b362ee4220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= link_to "Upvote", vote_polls_path(poll, :vote_type => "upvotes"), :remote => true %> | |
<%= link_to "Downvote", vote_polls_path(poll, :vote_type => "downvotes"), :remote => true %> | |
# Add :vote to your set_poll before_action | |
def vote | |
@poll.increment!(params[:vote_type].to_sym) if ["upvotes", "downvotes"].include?(params[:vote_type]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment