Skip to content

Instantly share code, notes, and snippets.

@johnbender
Forked from kellydunn/board controller
Created November 19, 2010 23:46
Show Gist options
  • Save johnbender/707428 to your computer and use it in GitHub Desktop.
Save johnbender/707428 to your computer and use it in GitHub Desktop.
def solve
is_solution = @board.partial_solution?(Board.from_hash(params[:solution]))
if is_solution
current_user.current_user_game_board.score!
else
current_user.current_user_game_board.missed_guess!
end
current_user.next_board!
render :json => {
:correct => is_solution,
:destination => post_solution_path
}
end
protected
def post_solution_path
if !current_user.in_game?
done_game_path(@game)
else
game_board_path(current_user.current_game,
current_user.current_board)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment