Skip to content

Commit

Permalink
Fix handling of check_change
Browse files Browse the repository at this point in the history
For #128
  • Loading branch information
asilano committed Aug 17, 2016
1 parent 3f5df90 commit 2df9afd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/games_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ def check_change
since_time = Time.httpdate(params[:since])

if @game.last_modified >= since_time
# Game state has changed. Call process_result to update the game state
process_result("OK", false)
# Game state has changed. Redirect to the play action to update the state
respond_to do |format|
format.js { redirect_to :action => 'play' }
format.html { render action: :show }
end
else
# No change. Render nothing, but do ensure the Last-Modified header is set
@last_mod = @game.last_modified
Expand Down

0 comments on commit 2df9afd

Please sign in to comment.