# Voting with sessions

**URL:** <https://www.ruby-forum.com/t/voting-with-sessions/143791>\
**Category:** Rails\
**Created:** [July 22, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/voting-with-sessions/143791 "2008-07-22T20:11:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [July 22, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/voting-with-sessions/143791/1 "2008-07-22T20:11:35Z")

</div>

hi - i want to enable voting on my site, but i don’t want to require a  
login. i realize people might clear their cookies and revote, that’s  
fine for now. the questions are:

1. how should i do this? Do i grab the id from the sessions table  
and link it with votes, or do i store the session hash in the votes  
table directly?

2. How do i ensure the session doesn’t expire for a long time?

3. how do i get the ‘session’ itself in rails? i.e. what does the code  
look like?

4. when does the inital session begin? when the user firsts vists my  
site? or, do i configure this?

thanks,  
Dino
