Quick question about userstamping records in a similar way to
timestamping. There is an example of how this might work at:
http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by/versions/7
This seems to work fine on my development system. However, I am not
sure how the User.current_user method, which is required, can guarantee
to return the correct user since this is a static accessor/method. If I
set the class-level current_user as part of my request processing, then
so long as no other requests come in in the mean time, all well and
good. however, if some other request is made by a different user
between me setting the current user and saving the record, then
presumably the record will be stamped with the other user.
Is there something special about class scope within rails, i.e. is it
scoped per request? Otherwise, what is the correct way to go about
this?
I’m no great Ruby expert, but have been using it for a while.
Ta