# Sessions from existing database

**URL:** <https://www.ruby-forum.com/t/sessions-from-existing-database/114562>\
**Category:** Rails\
**Created:** [September 15, 2007, 12:26pm UTC](https://www.ruby-forum.com/t/sessions-from-existing-database/114562 "2007-09-15T12:26:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f6c823/32.png) [@xinu](https://www.ruby-forum.com/u/xinu)\
**Post date:** [September 15, 2007, 12:26pm UTC](https://www.ruby-forum.com/t/sessions-from-existing-database/114562/1 "2007-09-15T12:26:18Z")

</div>

I want to read the login session data from an existing  
Database(oscommerce).

The sessions Table looks like this:  
sesskey (varchar(32))  
expiry (int(11))  
value (text)

I think I have to uncomment this line in the enviroment.rb  
config.active\_record.schema\_format = :sql

But how can I specify the schema of the sessions table?

Can anyone help me please.  
thanks in advance

michael

---

<div class="post-metadata">

**Author:** ![xinu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f6c823/32.png) [@xinu](https://www.ruby-forum.com/u/xinu)\
**Post date:** [September 15, 2007, 3:14pm UTC](https://www.ruby-forum.com/t/sessions-from-existing-database/114562/2 "2007-09-15T15:14:00Z")

</div>

Michael … wrote:

> I want to read the login session data from an existing  
> Database(oscommerce).
> 
> The sessions Table looks like this:  
> sesskey (varchar(32))  
> expiry (int(11))  
> value (text)
> 
> I think I have to uncomment this line in the enviroment.rb  
> config.active\_record.schema\_format = :sql
> 
> But how can I specify the schema of the sessions table?
> 
> Can anyone help me please.  
> thanks in advance
> 
> michael

did you mean the line “config.action\_controller.session\_store =  
:active\_record\_store” in environment.rb,

also the following comments are in  
actionpack/lib/action\_controller/session/active\_record\_store.rb

```
# You may configure the table name, primary key, and data column.
# For example, at the end of config/environment.rb:
# CGI::Session::ActiveRecordStore::Session.table_name = 

```

‘legacy\_session\_table’  
# CGI::Session::ActiveRecordStore::Session.primary\_key =  
‘session\_id’  
# CGI::Session::ActiveRecordStore::Session.data\_column\_name =  
‘legacy\_session\_data’  
# Note that setting the primary key to the session\_id frees you from  
# having a separate id column if you don’t want it. However, you  
must  
# set session.model.id = session.session\_id by hand! A  
before\_filter  
# on ApplicationController is a good place.
