I have a script that executes (shows a modal) at 35 minutes (from inactivity) alerting the user they are about to be logged out. If they click a button in that modal they can remain logged in or another button to log out. The problem is the script is running whether a user is logged in or not. How can I limit the script to only load and be run if there is a current_user.
I tried adding erb to my coffee script file and just using an if logged_in? block, but I get errors when trying to include the helper in that file. And, this seems like an awful way to do it.
file_name.coffee.erbthat will let you execute ruby in your coffee file.user-logged-in, which you can add in your layouts template. And then make your javascript dependent on whetherbody.user-logged-inis present. It's not pretty but it would work.