aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-06 18:43:32 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-06 18:43:32 +0000
commite5b86efea929e7ebe09317d20c6cc33a1042aeec (patch)
treef3ea631876f76871a53c6bc1ac0abe13d8f247e3
parenta0d31fcd81ef690adf56568aa954a07081c6aecc (diff)
downloadrails-e5b86efea929e7ebe09317d20c6cc33a1042aeec.tar.gz
rails-e5b86efea929e7ebe09317d20c6cc33a1042aeec.tar.bz2
rails-e5b86efea929e7ebe09317d20c6cc33a1042aeec.zip
Fixed that a SessionRestoreError was thrown if a model object was placed in the session that wasn't available to all controllers. This means that it's no longer necessary to use the 'model :post' work-around in ApplicationController to have a Post model in your session.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1741 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG5
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb39
2 files changed, 21 insertions, 23 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 4e6ebdb5be..37577f03b8 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,3 +1,8 @@
+*SVN*
+
+* Fixed that a SessionRestoreError was thrown if a model object was placed in the session that wasn't available to all controllers. This means that it's no longer necessary to use the 'model :post' work-around in ApplicationController to have a Post model in your session.
+
+
*1.9.0* (6 July, 2005)
* Added logging of the request URI in the benchmark statement (makes it easy to grep for slow actions)
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb
index bb34751f64..a8ac127ac7 100644
--- a/actionpack/lib/action_controller/cgi_process.rb
+++ b/actionpack/lib/action_controller/cgi_process.rb
@@ -95,29 +95,22 @@ module ActionController #:nodoc:
@session["__valid_session"]
return @session
rescue ArgumentError => e
- # 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}])"
- )
+ 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
end
end