aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/session/active_record_store.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/session/active_record_store.rb b/actionpack/lib/action_controller/session/active_record_store.rb
index 4700f2419a..60fd295fe8 100644
--- a/actionpack/lib/action_controller/session/active_record_store.rb
+++ b/actionpack/lib/action_controller/session/active_record_store.rb
@@ -251,24 +251,28 @@ class CGI
# Restore session state. The session model handles unmarshaling.
def restore
- @session.data
+ @session.data if @session
end
# Save session store.
def update
- @session.save!
+ @session.save! if @session
end
# Save and close the session store.
def close
- update
- @session = nil
+ if @session
+ update
+ @session = nil
+ end
end
# Delete and close the session store.
def delete
- @session.destroy rescue nil
- @session = nil
+ if @session
+ @session.destroy rescue nil
+ @session = nil
+ end
end
end