Hi, My client wants something to track actions on objects. For instance, if one of his employees makes an edit to the system, he wants a log of what happened. I started adding the after_create, after_update, after_destroy observer callbacks to the objects that he wants this for. They create a ''sitetransaction'' object (I use the term transaction loosly, because this isn''t the same as a database transaction) which will log what object was created/updated/deleted, who do this, and when. Pretty simple stuff. The issue is with the "who did this" part. I have the user name stored in a session variable. I can''t access the session data in the model. Any thoughts on how I can access the session data, or how I can accomplish this in a better way? Regards, Kevin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Perhaps you''re looking for something like acts_as_audited? On Dec 21, 2007 1:58 AM, Kevin Tambascio <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > My client wants something to track actions on objects. For instance, if > one of his employees makes an edit to the system, he wants a log of what > happened. I started adding the after_create, after_update, > after_destroy observer callbacks to the objects that he wants this for. > They create a ''sitetransaction'' object (I use the term transaction > loosly, because this isn''t the same as a database transaction) which > will log what object was created/updated/deleted, who do this, and when. > Pretty simple stuff. > > The issue is with the "who did this" part. I have the user name stored > in a session variable. I can''t access the session data in the model. > Any thoughts on how I can access the session data, or how I can > accomplish this in a better way? > > Regards, > Kevin > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Kevin Tambascio
2007-Dec-20 20:07 UTC
Re: Creating log of changes to active record objects
That''s exactly what I need. Thanks for the link! Ryan Bigg wrote:> Perhaps you''re looking for something like acts_as_audited? > > On Dec 21, 2007 1:58 AM, Kevin Tambascio > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > >> Pretty simple stuff. >> >> > >> > > > -- > Ryan Bigg > http://www.frozenplague.net-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---