Say I wanted to log all successful and failed saves to a special log table. But I also wanted to save the logged in user and some other session stuff. I assume I would have some sort of module included into the controllers, which would then do something with the methods of the objects being manipulated, but I''m not sure what the best approach is. I''ve tried a few variations of alias_method, but I''m struggling to get the information from the controller across to the context of the model. Does the answer involve binding perhaps? -- 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 -~----------~----~----~----~------~----~------~--~---
Use acts_as_audited. On 03/02/2009, at 8:53 AM, aa aa wrote:> > Say I wanted to log all successful and failed saves to a special log > table. But I also wanted to save the logged in user and some other > session stuff. > I assume I would have some sort of module included into the > controllers, > which would then do something with the methods of the objects being > manipulated, but I''m not sure what the best approach is. I''ve tried a > few variations of alias_method, but I''m struggling to get the > information from the controller across to the context of the model. > Does the answer involve binding perhaps? > -- > 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 -~----------~----~----~----~------~----~------~--~---
> Say I wanted to log all successful and failed saves to a special log > table. But I also wanted to save the logged in user and some other > session stuff. > I assume I would have some sort of module included into the > controllers, > which would then do something with the methods of the objects being > manipulated, but I''m not sure what the best approach is. I''ve tried a > few variations of alias_method, but I''m struggling to get the > information from the controller across to the context of the model. > Does the answer involve binding perhaps?This is what I did on a recent project... http://pjkh.com/articles/2009/02/02/creating-an-audit-log-in-rails -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---