# \[RoR\] Edge rails having problems with cookies and sessions?

**URL:** <https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690>\
**Category:** Rails\
**Created:** [March 5, 2007, 6:54am UTC](https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690 "2007-03-05T06:54:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [March 5, 2007, 6:54am UTC](https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690/1 "2007-03-05T06:54:35Z")

</div>

Rails people,

I just installed edge rails 6334

Script/server comes up okay but when I try to connect to my site  
the browser spits out a 500.

I see this in the console:

=\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application starting on [http://0.0.0.0:1111](http://0.0.0.0:1111)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server (see config/lighttpd.conf for options)  
DISPATCHER FAILSAFE RESPONSE (has cgi) Sun Mar 04 21:24:13 PST 2007  
Status: 500 Internal Server Error  
A secret is required to generate an integrity hash for cookie session  
data. Use config.action\_controller.session = { :secret =\> “some secret  
phrase” } in config/environment.rb

/pt/customers3/openwater/owcs/cs12/public/…/config/…/vendor/rails/actionpack/lib/action\_controller/session/cookie\_store.rb:49:in  
`initialize’

/Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/powerpc/lib/ruby/1.8/cgi/session.rb:273:in  
`initialize\_without\_cgi\_reader’

/pt/customers3/openwater/owcs/cs12/public/…/config/…/vendor/rails/actionpack/lib/action\_controller/cgi\_ext/session\_performance\_fix.rb:32:in  
`initialize’

I edited config/environment.rb like this:

Rails::Initializer.run do |config|  
config.action\_controller.session = { :secret =\> “some secret phrase X”  
}  
end

I bounced the server.

I tried the site and got another 500.

Now I see this:

Processing LoginController#index (for 127.0.0.1 at 2007-03-04 21:29:27)  
[GET]  
Session ID: f85a3a9b2667f3e0eb1c38f55dc2ede0  
Parameters: {“action”=\>“index”, “controller”=\>“login”}

ArgumentError (`name’ required):

/vendor/rails/actionpack/lib/action\_controller/cgi\_ext/cookie\_performance\_fix.rb:44:in  
`initialize’

/vendor/rails/actionpack/lib/action\_controller/session/cookie\_store.rb:129:in  
`write\_cookie’

Other people must be bumping into this issue; right?

I’ve done some searching with google; I see no evidence that others have  
bumped into this bug.

Any clues on how to deal with this cookie\_performance\_fix.rb  
ArgumentError ?

Info about my setup:

$ script/about  
About your application’s environment  
Ruby version 1.8.4 (powerpc-darwin7.9.0)  
RubyGems version 0.9.0  
Rails version 1.2.0  
Active Record version 1.14.4  
Action Pack version 1.12.5  
Action Web Service version 1.1.6  
Action Mailer version 1.2.5  
Active Support version 1.3.1  
Edge Rails revision 6334  
Application root /owcs/cs12  
Environment development  
Database adapter mysql  
Database schema version 112

-Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [March 5, 2007, 7:03am UTC](https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690/2 "2007-03-05T07:03:35Z")

</div>

I just tried edge rails 6149  
it seems to work okay  
(after I removed  
config.action\_controller.session = { :secret =\> “some secret phrase X” }  
from environment.rb)

It looks like some work has been done to sessions and cookies recently  
but I’m not finding any clues on how to work around the 500 I see when  
I try to create a session object in edge rails 6334.

Do I need to make some changes to my environment or install a gem or  
something?

-Peter

On 3/4/07, Peter S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> =\> Booting lighttpd (use ‘script/server webrick’ to force WEBrick)  
> `initialize' Rails::Initializer.run do |config| [GET] `write\_cookie’
> 
> Edge Rails revision 6334  
> Application root /owcs/cs12  
> Environment development  
> Database adapter mysql  
> Database schema version 112
> 
> -Peter

–  
Peter S.  
removed\_email\_address@domain.invalid  
[http://GoodJobFastCar.com](http://GoodJobFastCar.com)

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [March 5, 2007, 10:26am UTC](https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690/3 "2007-03-05T10:26:58Z")

</div>

People,

I figured this out.

It boiled down to a mismatch between my RAILS\_ROOT and my edge rails.

I did this to fix it…

-Install the latest version of Locomotive on my Mac  
-update gems with “gem update --system”  
-update rake with “gem update rake”  
-rails a\_new\_app  
-rake rails:freeze:edge  
-copy in my database.yml, routes.rb, migrations, models, controllers,  
views,  
images, stylesheets, and layouts  
(tip-toe around an extra line in application.rb)  
-Add a line to environment.rb:  
config.action\_controller.session = { :secret =\> “some secret  
phraseX” }

And script/server behaved like I like.

I’m happy now…

-Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [March 5, 2007, 7:42am UTC](https://www.ruby-forum.com/t/ror-edge-rails-having-problems-with-cookies-and-sessions/87690/4 "2007-03-05T07:42:39Z")

</div>

Here’s the change that is causing your problem:

[http://dev.rubyonrails.org/browser/trunk/actionpack/lib/](http://dev.rubyonrails.org/browser/trunk/actionpack/lib/)  
action\_controller/session/cookie\_store.rb

In short, you need to stuff something like the rdoc says in your  
environment.rb:

config.action\_controller.session = { :secret =\> “some secret phrase” }
