From 90048d87d69e4476a493f291723becf50609665b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 9 Sep 2013 11:49:00 +0100 Subject: [PATCH] Ignore exceptions clearing sessions Rails 3 sessions can't be loaded by rails 4 but reset_session also fails because it tries to clear the session, which tries to load it in to clear it. So monkey patch the session to ignore exceptions during clear so that out normal reset-on-exception logic will reset the session. --- config/initializers/session.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 config/initializers/session.rb diff --git a/config/initializers/session.rb b/config/initializers/session.rb new file mode 100644 index 000000000..83b2492fe --- /dev/null +++ b/config/initializers/session.rb @@ -0,0 +1,13 @@ +module ActionDispatch + class Request < Rack::Request + class Session + def clear_with_rescue + clear_without_rescue + rescue + # lets not worry about it... + end + + alias_method_chain :clear, :rescue + end + end +end -- 2.43.2