Fix New Game button
This commit is contained in:
parent
88c6ca6c57
commit
d163fa2eaa
@ -40,7 +40,8 @@ class TablesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new_game
|
def new_game
|
||||||
@table.add_game
|
@game = @table.add_game
|
||||||
|
@game.start
|
||||||
redirect_to @table
|
redirect_to @table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -182,8 +182,10 @@ private
|
|||||||
self.table ||= Table.create current_game_id: self.id
|
self.table ||= Table.create current_game_id: self.id
|
||||||
self.seats = self.table.seats
|
self.seats = self.table.seats
|
||||||
self.seats.each do |seat|
|
self.seats.each do |seat|
|
||||||
if seat.user_id || seat.user_soft_token
|
if (seat.user_id || seat.user_soft_token)
|
||||||
new_player = self.players.create(user_id: seat.user_id, soft_token: seat.user_soft_token)
|
new_player = self.players.create(user_id: seat.user_id, soft_token: seat.user_soft_token)
|
||||||
|
seat.player = new_player
|
||||||
|
seat.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.save
|
self.save
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user