diff --git a/app/assets/stylesheets/game.css.sass b/app/assets/stylesheets/game.css.sass index 7c982e2..d35368d 100644 --- a/app/assets/stylesheets/game.css.sass +++ b/app/assets/stylesheets/game.css.sass @@ -115,7 +115,6 @@ ol#cards-to-beat margin-left: -21vmin // Don't offset first card &:first-of-type - // margin-left: 0 margin-left: -4vmin flex: 1 1 auto //flex: 1 1 auto diff --git a/app/models/game.rb b/app/models/game.rb index 81bcf46..9899257 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -124,6 +124,11 @@ class Game < ActiveRecord::Base when 'next' self.controlling_player_id = self.next_player_id end + + # Clear play to beat if play returns to owner + if self.play_to_beat.try(:player).try(:id) == self.controlling_player_id + self.play_to_beat_id = nil + end end def joinable? user diff --git a/app/models/play_to_beat.rb b/app/models/play_to_beat.rb index d23b47c..a9287e3 100644 --- a/app/models/play_to_beat.rb +++ b/app/models/play_to_beat.rb @@ -1,4 +1,5 @@ class PlayToBeat < ActiveRecord::Base belongs_to :game belongs_to :play + has_one :player, through: :play end diff --git a/app/views/tables/_play_to_beat.html.haml b/app/views/tables/_play_to_beat.html.haml index eede81c..720b5d7 100644 --- a/app/views/tables/_play_to_beat.html.haml +++ b/app/views/tables/_play_to_beat.html.haml @@ -1,6 +1,6 @@ #play-to-beat %h4 Hand to beat: - - if @game.play_to_beat.play == nil + - if @game.play_to_beat == nil None - else