22 lines
482 B
Ruby
22 lines
482 B
Ruby
# frozen_string_literal: true
|
|
|
|
# 掲示板関連コントローラの共通ロジック
|
|
# set_game, set_board, set_current_participant を提供する
|
|
module BoardAccessible
|
|
extend ActiveSupport::Concern
|
|
|
|
private
|
|
|
|
def set_game
|
|
@game = Game.find(params[:game_id])
|
|
end
|
|
|
|
def set_board
|
|
@board = @game.boards.find(params[:board_id] || params[:id])
|
|
end
|
|
|
|
def set_current_participant
|
|
@current_participant = @game.participants.find_by(user: current_user)
|
|
end
|
|
end
|