acts_as_authenticated current_user in a model?

Am I reading correctly that this is just creating a class method on User that grabs the current_user out of the session in the ApplicationController before_filter?

Er, leaving aside the fact that this plugin seemed to return the incorrect user when I tried it.

-faisal

> http://delynnberry.com/projects/userstamp/

Am I reading correctly that this is just creating a class method on User that grabs the current_user out of the session in the ApplicationController before_filter?

You are mostly correct in your interpretation of what the plugin does, except you forgot to mention the automatic saving of the current user to the created_by and updated_by attributes of your ActiveRecord objects.

Er, leaving aside the fact that this plugin seemed to return the incorrect user when I tried it.

I freely admit that the current Userstamp plugin has some shortcomings (which is why I'm working on the second iteration--to be release soon), but since the plugin simply accesses the currently logged in user via whatever is in the session, are you sure it was the plugin that returned the incorrect user?

I freely admit that the current Userstamp plugin has some shortcomings (which is why I'm working on the second iteration--to be release soon), but since the plugin simply accesses the currently logged in user via whatever is in the session, are you sure it was the plugin that returned the incorrect user?

Could be. I'm currently using acts_as_authenticated, but with enough customizations that anything that normally works with acts_as_authenticated will likely break anyway.

-faisal

Could be. I'm currently using acts_as_authenticated, but with enough customizations that anything that normally works with acts_as_authenticated will likely break anyway.

If you are using acts_as_authenticated, you should be able to use the current_user method that's included with the AuthenticatedSystem module in the before filter.

I am using a variant of acts_as_authenticated, which stores the current user in a thread variable, which overcomes the problems that using class variable has with concurrency. It has been working fine for me.

Gregg