Retract the session fix until 0.13.1 to preserve the truthfulness of the book

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1730 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2005-07-06 08:58:34 +00:00
parent 2186ed83dd
commit 744058b699

View File

@@ -95,22 +95,29 @@ module ActionController #:nodoc:
@session["__valid_session"]
return @session
rescue ArgumentError => e
if e.message =~ %r{undefined class/module (\w+)}
begin
Module.const_missing($1)
rescue LoadError, NameError => e
raise(
ActionController::SessionRestoreError,
"Session contained objects where the class definition wasn't available. " +
"Remember to require classes for all objects kept in the session. " +
"(Original exception: #{e.message} [#{e.class}])"
)
end
retry
else
raise
end
# TODO: Uncomment this on 0.13.1
# if e.message =~ %r{undefined class/module (\w+)}
# begin
# Module.const_missing($1)
# rescue LoadError, NameError => e
# raise(
# ActionController::SessionRestoreError,
# "Session contained objects where the class definition wasn't available. " +
# "Remember to require classes for all objects kept in the session. " +
# "(Original exception: #{e.message} [#{e.class}])"
# )
# end
#
# retry
# else
# raise
# end
raise(
ActionController::SessionRestoreError,
"Session contained objects where the class definition wasn't available. " +
"Remember to require classes for all objects kept in the session. " +
"(Original exception: #{e.message} [#{e.class}])"
)
end
end