ruby-on-railsauthlogic

Ruby on Rails: how can I store additional data in the session for authlogic


I'm using Authlogic to authenticate users.

I understand how to create and use sessions, but want to store an additional id variable in the current_user session created by authlogic.

Can I just do something like this:

session[:authlogic_sess_name] = @extra_id.id

However, I'm not sure what the authlogic session is named though or how to access it.

Thanks!


Solution

  • Why would you not just store the value in the session?

    session[:extra] = @extra_id.id
    

    The Authlogic current_user is simply a value in the current session, managed by the Rails stack itself.