ファイル
btrc-hub/backend/app/controllers/gekanator_games_controller.rb
T
2026-06-08 00:30:20 +09:00

18 行
511 B
Ruby

class GekanatorGamesController < ApplicationController
def create
return head :unauthorized unless current_user
answers = params.require(:answers).as_json
game = GekanatorGame.create!(
user: current_user,
guessed_post_id: params.require(:guessed_post_id),
correct_post_id: params[:correct_post_id].presence,
won: bool?(:won),
question_count: params.require(:question_count),
answers:)
render json: { id: game.id }, status: :created
end
end