# Sessions (cookie)

**URL:** <https://www.ruby-forum.com/t/sessions-cookie/176462>\
**Category:** Rails\
**Created:** [September 30, 2009, 10:06pm UTC](https://www.ruby-forum.com/t/sessions-cookie/176462 "2009-09-30T22:06:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [September 30, 2009, 10:06pm UTC](https://www.ruby-forum.com/t/sessions-cookie/176462/1 "2009-09-30T22:06:30Z")

</div>

I am dealing with a legacy db and I really don’t want to add a sessions  
table unless I have to.

I am just using default setup in Rails 2.3.2 and I don’t see any  
declarations regarding sessions in config/environment[.rb|s/]

so I put a \<%= session.inspect %\> in my layout and the first screen I go  
to after the ‘login’ controller assigns some ‘session[:thingies]’ they  
show up but not at any subsequent page so I think they are getting lost  
on me.

What am I missing? I cannot see from [api.rubyonrails.org](http://api.rubyonrails.org) what it is I  
should be doing. Shouldn’t sessions persist?

craig

–  
This message has been scanned for viruses and  
dangerous content by MailScanner, and is  
believed to be clean.

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [September 30, 2009, 11:25pm UTC](https://www.ruby-forum.com/t/sessions-cookie/176462/2 "2009-09-30T23:25:32Z")

</div>

Have a look at

> **[Action Controller Overview — Ruby on Rails Guides](https://guides.rubyonrails.org/action_controller_overview.html)**
>
> Action Controller OverviewIn this guide, you will learn how controllers work and how they fit into the request cycle in your application.After reading this guide, you will know: How to follow the flow of a request through a controller. How to...

What you want is a cookie session store which stores the session on  
the client, but this should be the default unless you have changed it.

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 1, 2009, 2:44am UTC](https://www.ruby-forum.com/t/sessions-cookie/176462/3 "2009-10-01T02:44:00Z")

</div>

On Wed, 2009-09-30 at 14:23 -0700, heimdull wrote:

> Have a look at  
> [Action Controller Overview — Ruby on Rails Guides](http://guides.rubyonrails.org/action_controller_overview.html)
> 
> What you want is a cookie session store which stores the session on  
> the client, but this should be the default unless you have changed it.

* * *

apparently I was fine except that I needed a value in session[:user\_id]  
because it was calling ‘authenticate’ and ‘authorize’ and I was only  
looking at the ‘authorize’ section because I had already ‘authenticated’

- stupid me.

Thanks

Craig

–  
This message has been scanned for viruses and  
dangerous content by MailScanner, and is  
believed to be clean.
