I want to share the session between a Rails 2.3.14 app and a Rails 3.0.10 app by using the session cookie store.
I found an excellent blogpost that explains how to set that up: http://blog.kabisa.nl/2010/10/27/share-sessions-between-rails-2-and-rails-3-applications/
It all works fine up until the point where the issue is raised that Rails2 stores session keys as symbols, and Rails3 as strings. Also a patch has been supplied to fix this:
# lib/patches/cgi/session.rb
require 'cgi/session'
class CGI #:nodoc:
class Session #:nodoc:
def [](key)
@data ||= @dbman.restore
@data[key.to_s]
end
def []=(key, val)
@write_lock ||= true
@data ||= @dbman.restore
@data[key.to_s] = val
end
end
end
The blog is from 2010, and it looks like this patch is longer working for a Rails2.3.14 app. I also read that CGI really deprecated, so I wonder if this patch is still the right way to resolve the issue.
Any suggestions how to make sure that both Rails2 and Rails3 use the same data type for session keys?