docbrown/app/controllers/poll_skips_controller.rb
Anna Buianova f79b3cb12a Fixed rubocop issues, new .rubocop_todo.yml (#3255)
* Fixed rubocop issues, new .rubocop_todo.yml

* Refined and fixed indentation
2019-06-21 14:26:39 -04:00

19 lines
594 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