I set up a gon variable for checking if current user is available in controller.
gon.watch.has_current_user = current_user.present?
I open a page (with current user presents) and duplicate that page to a new browser window.
I logged out in one page and call gon.watch('has_current_user'), then call alert(gon.has_current_user in the console. The variable was updated from true to false successfully.
Now I called the same two methods in the page I had not logged out. I assume that the variable must be checked and updated again by gon.watch and become false, too. However, the current_user still existed there.
Why?
I set up a gon variable for checking if current user is available in controller.
gon.watch.has_current_user = current_user.present?
I open a page (with current user presents) and duplicate that page to a new browser window. I logged out in one page and callgon.watch('has_current_user')
, then callalert(gon.has_current_user
in the console. The variable was updated from true to false successfully. Now I called the same two methods in the page I had not logged out. I assume that the variable must be checked and updated again by gon.watch and become false, too. However, the current_user still existed there. Why?