refactor: BoardAccessible concernを導入し、ボード関連コントローラを整理、ターン表示ロジックをTurnモデルへ移動し、ボード提案表示をコントローラで処理するよう変更
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-02-19 22:46:24 +09:00
parent bb9ec2df1d
commit e90ea88758
9 changed files with 70 additions and 136 deletions

View File

@@ -1,4 +1,6 @@
class BoardPostsController < ApplicationController
include BoardAccessible
before_action :require_login
before_action :set_game
before_action :set_board
@@ -13,11 +15,9 @@ class BoardPostsController < ApplicationController
@post = @board.board_posts.new(post_params)
@post.participant = @current_participant
# フェーズ情報の付与
# 最新のターン情報を取得してセットする
latest_turn = @game.turns.order(number: :desc).first
if latest_turn
@post.phase = latest_turn.phase
# フェーズ情報の付与latest_turnアソシエーションを使用
if @game.latest_turn
@post.phase = @game.latest_turn.phase
end
if @post.save
@@ -29,18 +29,6 @@ class BoardPostsController < ApplicationController
private
def set_game
@game = Game.find(params[:game_id])
end
def set_board
@board = @game.boards.find(params[:board_id])
end
def set_current_participant
@current_participant = @game.participants.find_by(user: current_user)
end
def post_params
params.require(:board_post).permit(:body)
end