From e6b2e7fbeab495a9ce0533d3f778cca9cb268597 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 13 Oct 2011 02:17:01 +0530 Subject: refactor guide example --- railties/guides/source/security.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/guides/source/security.textile') diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile index 0f100e0adf..8837e06de5 100644 --- a/railties/guides/source/security.textile +++ b/railties/guides/source/security.textile @@ -157,9 +157,9 @@ One possibility is to set the expiry time-stamp of the cookie with the session i class Session < ActiveRecord::Base def self.sweep(time = 1.hour) - time = time.split.inject { |count, unit| - count.to_i.send(unit) - } if time.is_a?(String) + if time.is_a?(String) + time = time.split.inject { |count, unit| count.to_i.send(unit) } + end delete_all "updated_at < '#{time.ago.to_s(:db)}'" end -- cgit v1.2.3