server/app/channels/players_channel.rb
# Destroy game and disconnect everyone if host disconnects
Destroy game and disconnect everyone if host disconnects
Destroy game and disconnect everyone if host disconnects
def unsubscribed
    if @host
      game = @host.game
      if game 
        game.rounds.each {|round| round.answers.destroy_all}
        game.rounds.destroy_all
        game.players.destroy_all 
        game.destroy
      end
    end
  end
def unsubscribed if @host game = @host . game if game game . rounds . each { | round | round . answers . destroy_all } game . rounds . destroy_all game . players . destroy_all game . destroy end end end
Destroy game and disconnect everyone if host disconnects
Destroy game and disconnect everyone if host disconnects
# Do cleanup # Delete everything for game 