views:

323

answers:

2

Hi, all. I have shared between 2 sites ActiveRecord Session Store. On the first i've created UserSession object. Is there any way to restore UserSession on the second if i know session_id?

A: 

I think you have to store the session in a database table and so you can access it from different rails apps.

In environment.rb:

config.action_controller.session_store = :active_record_store

With

rake db:sessions:create

you create the following sessions-table

create_table :sessions do |t|
  t.string :session_id, :null => false
  t.text :data
  t.timestamps
end

add_index :sessions, :session_id
add_index :sessions, :updated_at
Lichtamberg
ok, but maybe you have working example?
Alexey Poimtsev
Updated my answer
Lichtamberg
huh ... I've already developed solution and i've described in my blog. This post is in russian lang, but you can translate in to english using google translate - http://tinyurl.com/y976yhn
Alexey Poimtsev
A: 

I've described solution in my blog - http://tinyurl.com/y976yhn

Alexey Poimtsev