Fix missing record error with find_by
This commit is contained in:
parent
77fa19dee7
commit
1085ed17a6
@ -45,11 +45,7 @@ class Game < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def winner
|
||||
begin
|
||||
self.players.find(self.winner_player_id)
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
self.players.find_by_id(self.winner_player_id)
|
||||
end
|
||||
|
||||
def validate_startable
|
||||
@ -145,7 +141,7 @@ class Game < ActiveRecord::Base
|
||||
# The player whose turn it is
|
||||
def controlling_player
|
||||
if self.controlling_player_id
|
||||
self.players.find(self.controlling_player_id)
|
||||
self.players.find_by_id(self.controlling_player_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user