# Authlogic and Sessions

**URL:** <https://www.ruby-forum.com/t/authlogic-and-sessions/182057>\
**Category:** Rails\
**Created:** [January 22, 2010, 5:02am UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057 "2010-01-22T05:02:17Z")\
**Posts on this page:** 7\
**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:** [January 22, 2010, 5:02am UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/1 "2010-01-22T05:02:17Z")

</div>

trying out Authlogic for the first time (joined the mail list but  
apparently the first message is moderated and it’s been hours)…

created db sessions but when I log in, no entry is added to sessions db

Maybe it’s because my ‘user’ model is named ‘member’ and thus I  
substituted /user/member/ and /User/Member/ but I wouldn’t think so.

I can login and save passwords but cannot get value from  
‘current\_member’ or any session variables either.

Should I be creating a member\_sessions table in the db or does the  
standard Rails sessions table handle this function? I ask because it is  
empty.

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:** [January 22, 2010, 6:00am UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/2 "2010-01-22T06:00:49Z")

</div>

No, you do not need to create a model named member. User is sufficient.  
But you have create user\_session model a user\_sessions controller.

Try doing exactly as said in this-

> **[GitHub - binarylogic/authlogic\_example: An example rails app using the...](https://github.com/binarylogic/authlogic_example/)**
>
> An example rails app using the Authlogic authentication library - GitHub - binarylogic/authlogic\_example: An example rails app using the Authlogic authentication library

Let us know if you are facing problems still.

On Thu, Jan 21, 2010 at 8:00 PM, Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> believed to be clean.

–  
Satyajit

---

<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:** [January 22, 2010, 7:01am UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/3 "2010-01-22T07:01:07Z")

</div>

I found ryanb’s railscast video helpful too:

> **[\#160 Authlogic - RailsCasts](http://railscasts.com/episodes/160-authlogic)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

---

<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:** [January 22, 2010, 11:11am UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/4 "2010-01-22T11:11:01Z")

</div>

Hello.

Try adding this line to config/environment.rb in config block:

config.action\_controller.session\_store = :active\_record\_store

---

<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:** [January 22, 2010, 1:46pm UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/5 "2010-01-22T13:46:08Z")

</div>

On Thu, 2010-01-21 at 23:51 -0800, Ugis Ozols wrote:

> Hello.
> 
> Try adding this line to config/environment.rb in config block:
> 
> config.action\_controller.session\_store = :active\_record\_store

* * *

yes, this was needed. I think I expected that this was going to be added  
automatically when I ran ‘rake db:sessions:create’ command but now at  
least it is adding sessions to the sessions table.

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:** [January 22, 2010, 5:37pm UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/6 "2010-01-22T17:37:59Z")

</div>

On Fri, 2010-01-22 at 05:44 -0700, Craig W. wrote:

> On Thu, 2010-01-21 at 23:51 -0800, Ugis Ozols wrote:
> 
> > Hello.
> > 
> > Try adding this line to config/environment.rb in config block:
> > 
> > config.action\_controller.session\_store = :active\_record\_store
> 
> * * *
> 
> yes, this was needed. I think I expected that this was going to be added  
> automatically when I ran ‘rake db:sessions:create’ command but now at  
> least it is adding sessions to the sessions table.

* * *

my questions are still not coming out on the authlogic list…

Each link I touch on my web site creates an identical session record in  
sessions table… (identical session\_id and data columns)

and if I don’t disable ‘protect\_from\_forgery’, I get  
InvalidAuthenticityToken error upon login.

Perhaps this is caused by my using ‘Member’ instead of ‘User’ and  
‘MemberSessions’ instead of ‘UserSessions’ throughout but I wouldn’t  
think so.

Something in my sessions is not working correctly

also, FTR… I found ‘config.action\_controller.session\_store  
= :active\_record\_store’ commented out in  
config/initializers/session\_store.rb and uncommented that one and  
commented out the added entry in config/environment.rb.

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:** [January 23, 2010, 5:49pm UTC](https://www.ruby-forum.com/t/authlogic-and-sessions/182057/7 "2010-01-23T17:49:56Z")

</div>

On Fri, 2010-01-22 at 09:36 -0700, Craig W. wrote:

> > least it is adding sessions to the sessions table.  
> > ‘MemberSessions’ instead of ‘UserSessions’ throughout but I wouldn’t  
> > think so.
> 
> Something in my sessions is not working correctly
> 
> also, FTR… I found ‘config.action\_controller.session\_store  
> = :active\_record\_store’ commented out in  
> config/initializers/session\_store.rb and uncommented that one and  
> commented out the added entry in config/environment.rb.

* * *

FTR

Had to close all instances of the browser and reload… that was simple  
enough but a lot of time wasted figuring it out. Leaving the footsteps  
in case anyone else has this issue.

Craig

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