docbrown/app/controllers/poll_skips_controller.rb
Ben Halpern 8ae057b06e
Beta polls feature (admin use only for now) (#3176)
* Initial poll features

* Add basic poll functionality

* Finish (maybe) beta poll functionality
2019-06-15 17:33:30 -04:00

19 lines
555 B
Ruby

class PollSkipsController < ApplicationController
before_action :authenticate_user!, only: %i[create]
def create
@poll_skip = PollSkip.create(poll_id: poll_skips_params[:poll_id], user_id: current_user.id)
@poll = Poll.find(poll_skips_params[:poll_id])
render json: { voting_data: @poll.voting_data,
poll_id: poll_skips_params[:poll_id].to_i,
user_vote_poll_option_id: nil,
voted: false }
end
private
def poll_skips_params
accessible = %i[poll_id]
params.require(:poll_skip).permit(accessible)
end
end