# Protect\_from\_forgery with db-session (Rails 2.3.2)

**URL:** <https://www.ruby-forum.com/t/protect-from-forgery-with-db-session-rails-2-3-2/170764>\
**Category:** Rails\
**Created:** [June 22, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/protect-from-forgery-with-db-session-rails-2-3-2/170764 "2009-06-22T15:53:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robintw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@robintw](https://www.ruby-forum.com/u/robintw)\
**Post date:** [June 22, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/protect-from-forgery-with-db-session-rails-2-3-2/170764/1 "2009-06-22T15:53:10Z")

</div>

I try to use db-session with protect\_from\_forgery.

But I always get a error msg:

ActionController::InvalidAuthenticityToken.

application\_controller.rb  
protect\_from\_forgery #:secret =\> ‘top\_secret’

session\_store.rb  
ActionController::Base.session\_store = :active\_record\_store

hope you can help me.

Best regards

---

<div class="post-metadata">

**Author:** ![robintw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@robintw](https://www.ruby-forum.com/u/robintw)\
**Post date:** [June 22, 2009, 4:05pm UTC](https://www.ruby-forum.com/t/protect-from-forgery-with-db-session-rails-2-3-2/170764/2 "2009-06-22T16:05:47Z")

</div>

After searching around it looks for me, like the authenticity\_token of  
the forum is not saved correctly by the session.

An therefore rails thinks the authenticity\_token is invalid.

---

<div class="post-metadata">

**Author:** ![robintw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@robintw](https://www.ruby-forum.com/u/robintw)\
**Post date:** [June 22, 2009, 5:18pm UTC](https://www.ruby-forum.com/t/protect-from-forgery-with-db-session-rails-2-3-2/170764/3 "2009-06-22T17:18:17Z")

</div>

[https://rails.lighthouseapp.com/projects/8994/tickets/2368-rails-232-sessions-problem](https://rails.lighthouseapp.com/projects/8994/tickets/2368-rails-232-sessions-problem)
