diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:16:07 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:16:07 +0100 |
commit | 1bfce3f29d958a14ca1502d3d36a9a2bc1de3734 (patch) | |
tree | c170df3f5d2886a669ad757af931a8bb515b0202 /guides/source/security.md | |
parent | 48f5cecdb03f697a710169ccef1885fcaca70788 (diff) | |
parent | 4f813a85d8919a83dd6fc019614f6aea7af7d5ae (diff) | |
download | rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.tar.gz rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.tar.bz2 rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.zip |
Merge pull request #22626 from gsamokovarov/appliation-record-documentation-fixes
Appliation record documentation fixes
Diffstat (limited to 'guides/source/security.md')
-rw-r--r-- | guides/source/security.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/security.md b/guides/source/security.md index b301736c36..1d0e87d831 100644 --- a/guides/source/security.md +++ b/guides/source/security.md @@ -171,7 +171,7 @@ NOTE: _Sessions that never expire extend the time-frame for attacks such as cros One possibility is to set the expiry time-stamp of the cookie with the session id. However the client can edit cookies that are stored in the web browser so expiring sessions on the server is safer. Here is an example of how to _expire sessions in a database table_. Call `Session.sweep("20 minutes")` to expire sessions that were used longer than 20 minutes ago. ```ruby -class Session < ActiveRecord::Base +class Session < ApplicationRecord def self.sweep(time = 1.hour) if time.is_a?(String) time = time.split.inject { |count, unit| count.to_i.send(unit) } |