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
|
end
|
||||||
|
|
||||||
def winner
|
def winner
|
||||||
begin
|
self.players.find_by_id(self.winner_player_id)
|
||||||
self.players.find(self.winner_player_id)
|
|
||||||
rescue
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_startable
|
def validate_startable
|
||||||
@ -145,7 +141,7 @@ class Game < ActiveRecord::Base
|
|||||||
# The player whose turn it is
|
# The player whose turn it is
|
||||||
def controlling_player
|
def controlling_player
|
||||||
if self.controlling_player_id
|
if self.controlling_player_id
|
||||||
self.players.find(self.controlling_player_id)
|
self.players.find_by_id(self.controlling_player_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user