Session share between rails 3 and rails 4 of the application

I found some links here on stackoverflow and a lot more outside, but they didn't help me. I currently have two applications, R3 (on rails 3) and R4 (on rails 4). Both use cookie storage to store the session.

Cookie store:

# R4
MyApp::Application.config.session_store :cookie_store, key: '_app.com_session', :domain => ".app.com", tld_length: 2

      

I inserted the same keys for:

# R4:
Devise.setup do |config|
  config.secret_key = 'SECRET'
end

# R3:
Devise.setup do |config|
  config.secret_key = 'SECRET'
end

      


# R4:
production:
  secret_key_base: 'TOKEN'

# R3:
MyApp::Application.config.secret_token = 'TOKEN'

      

Also I changed the cookie serialization for R4 app:

# R4
Rails.application.config.action_dispatch.cookies_serializer = :marshal

      

But that won't work.

It looks like Rails 4's approach to cookie storage has changed and the two are incompatible. Is there a way to share a session between two apps R3 and R4?

UPDATE:

I currently have an R3 application sharing session group already. So I find it difficult to update all R3 apps. The main question is what is the easiest way to get R3 and R4 to speak the same language.

Is there a way to downgrade R4's cookie handling algorithm? I am also thinking of storing all sessions in the database (this doesn't seem like a change in R4).

+3


source to share





All Articles