# Modifying the session :key

**URL:** <https://www.ruby-forum.com/t/modifying-the-session-key/178475>\
**Category:** Rails\
**Created:** [November 5, 2009, 6:02am UTC](https://www.ruby-forum.com/t/modifying-the-session-key/178475 "2009-11-05T06:02:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 5, 2009, 6:02am UTC](https://www.ruby-forum.com/t/modifying-the-session-key/178475/1 "2009-11-05T06:02:50Z")

</div>

Hello,

I have my base session settings in config/initializers/session\_store.rb

I want to override the :key option in one of my environment files. I’m  
attempting to do so like this…

config.action\_controller.session[:key] = ‘\_new\_sesssion\_key’

But when I examine the cookies for the site, it’s using the :key set in  
the config/initializers/session\_store.rb still.

Any idea how I go about overriding the :key in my environment files?

Thanks,  
Andrew

---

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [November 5, 2009, 7:01am UTC](https://www.ruby-forum.com/t/modifying-the-session-key/178475/2 "2009-11-05T07:01:26Z")

</div>

Andrew K. wrote:

> Hello,
> 
> I have my base session settings in config/initializers/session\_store.rb
> 
> I want to override the :key option in one of my environment files. I’m  
> attempting to do so like this…
> 
> config.action\_controller.session[:key] = ‘\_new\_sesssion\_key’
> 
> But when I examine the cookies for the site, it’s using the :key set in  
> the config/initializers/session\_store.rb still.
> 
> Any idea how I go about overriding the :key in my environment files?
> 
> Thanks,  
> Andrew

I’m just moving the settings in config/initializers/session\_store.rb to  
environment.rb and overriding in my other environment file for the time  
being which seems to work.
