# How to destroy objects associated with cookie-based sessions?

**URL:** <https://www.ruby-forum.com/t/how-to-destroy-objects-associated-with-cookie-based-sessions/122777>\
**Category:** Rails\
**Created:** [December 12, 2007, 2:49am UTC](https://www.ruby-forum.com/t/how-to-destroy-objects-associated-with-cookie-based-sessions/122777 "2007-12-12T02:49:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 12, 2007, 2:49am UTC](https://www.ruby-forum.com/t/how-to-destroy-objects-associated-with-cookie-based-sessions/122777/1 "2007-12-12T02:49:09Z")

</div>

If the id of an ActiveRecord object is stored in a cookie-based  
session, how can that object be destroyed when the session expires? I  
am aware of a technique for doing this with db-backed sessions, but  
I’m not clear on how this could be done with Rails 2.0 cookie-based  
sessions. Any help would be appreciated.
