Use session.delete to remove entries instead of assigning nil
authorTom Hughes <tom@compton.nu>
Wed, 1 Jun 2011 09:17:54 +0000 (10:17 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 1 Jun 2011 09:17:54 +0000 (10:17 +0100)
app/controllers/application_controller.rb
app/controllers/user_controller.rb

index 122349affca241f5fdfc70c6322b851a3a5ce2fa..1d3297d16eb4ceabe4994a04293850dfbb849f9a 100644 (file)
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
       @user = User.find(session[:user], :conditions => {:status => ["active", "confirmed", "suspended"]})
 
       if @user.status == "suspended"
-        session[:user] = nil
+        session.delete(:user)
         session_expires_automatically
 
         redirect_to :controller => "user", :action => "suspended"
index 97b0de73c79fdf4d85676069df17a816a6989fd3..283e11936f55b2b5ec682f7c672e6f863966fcec 100644 (file)
@@ -272,9 +272,9 @@ class UserController < ApplicationController
         if token
           token.destroy
         end
-        session[:token] = nil
+        session.delete(:token)
       end
-      session[:user] = nil
+      session.delete(:user)
       session_expires_automatically
       if params[:referer]
         redirect_to params[:referer]