* Replace PollSkips find_or_create_by with create_or_find_by * Use insert_all to add users to a channel in bulk * Use bulk insert for DataUpdateScript and set private what shall be private * oops
22 lines
506 B
Ruby
22 lines
506 B
Ruby
class PollSkipsController < ApplicationController
|
|
before_action :authenticate_user!, only: %i[create]
|
|
|
|
def create
|
|
poll = Poll.find(poll_skips_params[:poll_id])
|
|
poll.poll_skips.create_or_find_by(user_id: current_user.id)
|
|
|
|
render json: {
|
|
voting_data: poll.voting_data,
|
|
poll_id: poll.id,
|
|
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
|