Thought I had restarted server before posting but did it again.
Sessions now working.
Sorry
Stuart
On 8/31/06, Dark Ambient
<sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Question -
> I''m using acts_as_authenticated and would like to store sessions
in
> ActiveRecord.
> I''ve done the correct call in config/environment.rb
> Still no sessions are being recorded in AR.
>
> In looking through the code of AAA I see in authenticated_system.rb
> there is this call:
>
> module AuthenticatedSystem
> protected
> # Returns true or false if the user is logged in.
> # Preloads @current_user with the user model if they''re logged
in.
> def logged_in?
> (@current_user ||= session[:user] ?
> User.find_by_id(session[:user]) : :false).is_a?(User)
> end
>
> # Accesses the current user from the session.
> def current_user
> @current_user if logged_in?
> end
>
> # Store the given user in the session.
> def current_user=(new_user)
> session[:user] = (new_user.nil? || new_user.is_a?(Symbol)) ? nil
> : new_user.id
> @current_user = new_user
> end
>
> Shouldn''t the def current_user set the user id in an active record
session ?
>
> TIA
> Stuart
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---