Skip to content
Browse files

Log ActiveRecordStore debugging.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3107 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent f18463f commit c7bc10b2e4a946f895071e084d0d8fde01189ae0 @jeremy jeremy committed Nov 20, 2005
Showing with 19 additions and 0 deletions.
  1. +19 −0 actionpack/lib/action_controller/session/active_record_store.rb
View
19 actionpack/lib/action_controller/session/active_record_store.rb
@@ -279,6 +279,9 @@ def initialize(session, option = nil)
end
@session = @@session_class.new(:session_id => session_id, :data => {})
@session.save
+ logger.debug "opened new session #{@session.session_id}" if logger
+ else
+ logger.debug "reopened session #{@session.session_id}" if logger
end
end
@@ -290,33 +293,49 @@ def model
# Restore session state. The session model handles unmarshaling.
def restore
if @session
+ logger.debug "restore session #{@session.session_id}" if logger
@session.data
+ else
+ logger.debug "skipped restore nil session" if logger
end
end
# Save session store.
def update
if @session
+ logger.debug "update session #{@session.session_id}" if logger
ActiveRecord::Base.silence { @session.save }
+ else
+ logger.debug "skipped update nil session" if logger
end
end
# Save and close the session store.
def close
if @session
+ logger.debug "close session #{@session.session_id}" if logger
update
@session = nil
+ else
+ logger.debug "skipped close nil session" if logger
end
end
# Delete and close the session store.
def delete
if @session
+ logger.debug "delete session #{@session.session_id}" if logger
ActiveRecord::Base.silence { @session.destroy }
@session = nil
+ else
+ logger.debug "skipped delete nil session" if logger
end
end
+ protected
+ def logger
+ ActionController::Base.logger rescue nil
+ end
end
end
end

0 comments on commit c7bc10b

Please sign in to comment.
Something went wrong with that request. Please try again.