# Baking rails 1.2.6 cookies and sessions

**URL:** <https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495>\
**Category:** Rails\
**Created:** [February 8, 2008, 4:02am UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495 "2008-02-08T04:02:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikey\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikey\_P](https://www.ruby-forum.com/u/Mikey_P)\
**Post date:** [February 8, 2008, 4:02am UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495/1 "2008-02-08T04:02:27Z")

</div>

Hi,

Is there documentation on how to use CookieStore for sessions in rails  
1.2.6?

I have added this to environment.rb, but it’s not working.

config.action\_controller.session\_store = {  
:session\_key =\> ‘\_yummy\_session’,  
:secret =\> ‘seakret’  
}

Is there anything else I need to do?

Thu Feb 07 04:28:16 -0500 2008 (25051) You have a nil object when you didn't expect it! The error occurred while evaluating nil.restore /usr/lib/ruby/1.8/cgi/session.rb:304:in `[]' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:127:in `session' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/cgi\_process.rb:155:in `stale_session_check!' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/cgi_process.rb:110:in `session' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/base.rb:1052:in `assign_shortcuts_without_flash' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/flash.rb:140:in `assign\_shortcuts' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/base.rb:424:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process\_without\_session\_management\_support' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/session\_management.rb:114:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:76:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:74:in `synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/rails.rb:74:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:155:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:154:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:154:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:281:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:281:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:264:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:264:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel.rb:264:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/configurator.rb:282:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/configurator.rb:281:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/configurator.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails:128:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/../lib/mongrel/command.rb:212:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:in `load' /usr/bin/mongrel\_rails:19

Thanks,  
Mikey

---

<div class="post-metadata">

**Author:** ![Mikey\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikey\_P](https://www.ruby-forum.com/u/Mikey_P)\
**Post date:** [February 8, 2008, 4:04am UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495/2 "2008-02-08T04:04:48Z")

</div>

On 2/7/08, Mikey P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> }
> 
> Is there anything else I need to do?

You need to upgrade to Rails 2 which has the cookie store 🙂

jeremy

---

<div class="post-metadata">

**Author:** ![Mikey\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikey\_P](https://www.ruby-forum.com/u/Mikey_P)\
**Post date:** [February 8, 2008, 5:22pm UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495/3 "2008-02-08T17:22:16Z")

</div>

Seriously, I am wondering how to make cookie store work with rails 1.2x  
I cannot upgrade to 2.0.2.

---

<div class="post-metadata">

**Author:** ![Mikey\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikey\_P](https://www.ruby-forum.com/u/Mikey_P)\
**Post date:** [February 8, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495/4 "2008-02-08T17:42:56Z")

</div>

On 8 Feb 2008, at 03:01, Mikey P. wrote:

> }
> 
> Is there anything else I need to do?

Well at a bare minimum you’ll need to lift the cookie\_store.rb from  
rails 2.0 and add it to your local copy of rails (if you’ve frozen  
your gems into vendor then you can do this without messing with your  
other rails apps. You’ll also have to modify session\_management.rb to  
load cookie store, and hope that the interface that session stores  
present hasn’t changed much between 1.2 and 2.0

Fred

---

<div class="post-metadata">

**Author:** ![Mikey\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikey\_P](https://www.ruby-forum.com/u/Mikey_P)\
**Post date:** [February 8, 2008, 7:28pm UTC](https://www.ruby-forum.com/t/baking-rails-1-2-6-cookies-and-sessions/128495/5 "2008-02-08T19:28:50Z")

</div>

On Fri, Feb 8, 2008 at 11:42 AM, Frederick C. \<  
removed\_email\_address@domain.invalid\> wrote:

> > 
> 
> other rails apps. You’ll also have to modify session\_management.rb to  
> load cookie store, and hope that the interface that session stores  
> present hasn’t changed much between 1.2 and 2.0

Oh. I got this splendid idea from reading Obie F.'s book “The  
Rails  
Way”  
In it he says that if you want to use CookieStore with Rails 1.2x you  
need  
to use the above line.

I guess the book is incorrect, if what you say is true.
