Skip to content

Instantly share code, notes, and snippets.

@shawndeprey
Last active November 13, 2019 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawndeprey/e1f9c39aed8f036c78962e108b0b7b34 to your computer and use it in GitHub Desktop.
Save shawndeprey/e1f9c39aed8f036c78962e108b0b7b34 to your computer and use it in GitHub Desktop.
User code snippit for SPA article
class User < ApplicationRecord
def set_timeout!
self.timeout = 15.minutes.from_now
self.save
end
def should_session_remain_active?
return false if timeout.blank?
timeout.future?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment