Hi, I would like to create audit tables in my RoR/mysql app. I would like to start out auditing just about everything: every change in the database should result in a row in (one or more) audit tables. My app requires login, so I would like to include the user_id in all entries. Is there a good starting point for this or should I simply design the table(s), build triggers, etc.? Thanks, Marc --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I would like to create audit tables in my RoR/mysql app. I would like to > start out auditing just about everything: every change in the database > should result in a row in (one or more) audit tables. My app requires > login, so I would like to include the user_id in all entries. > > Is there a good starting point for this or should I simply design the > table(s), build triggers, etc.?http://agilewebdevelopment.com/plugins/search?search=audit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There is this plugin I found from a google search. I''ve not used it, but check it out and see if it''s what you need. http://opensoul.org/2006/7/21/acts_as_audited On Aug 30, 5:48 pm, "Marc Byrd" <dr.marc.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I would like to create audit tables in my RoR/mysql app. I would like to > start out auditing just about everything: every change in the database > should result in a row in (one or more) audit tables. My app requires > login, so I would like to include the user_id in all entries. > > Is there a good starting point for this or should I simply design the > table(s), build triggers, etc.? > > Thanks, > > Marc--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8/30/07, Marc Byrd <dr.marc.byrd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I would like to create audit tables in my RoR/mysql app. I would like to > start out auditing just about everything: every change in the database > should result in a row in (one or more) audit tables. My app requires > login, so I would like to include the user_id in all entries. > > Is there a good starting point for this or should I simply design the > table(s), build triggers, etc.?You need to learn about AR''s callbacks (http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html), which are "hooks" where you can add the auditing code. Also, google for "rails created_by" for some articles related to the issue of getting the user id. It''s not as easy as it looks, because the model code (where the callbacks are) doesn''t really have access to the controller (where the user id is). It can be done (I''m doing it), but you need to read up on the various considerations, especially thread-safety. HTH --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have a similar requirement as I''m working on a database system for clinical trials. I''ve investigated the plugins mentioned but I wasn''t too comfortable for many reasons, especially with the ability to reconstruct from audit trail. I''m actually looking into extending the ActiveRecord. On Aug 30, 5:48 pm, "Marc Byrd" <dr.marc.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I would like to create audit tables in my RoR/mysql app. I would like to > start out auditing just about everything: every change in the database > should result in a row in (one or more) audit tables. My app requires > login, so I would like to include the user_id in all entries. > > Is there a good starting point for this or should I simply design the > table(s), build triggers, etc.? > > Thanks, > > Marc--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joon You wrote:> I have a similar requirement as I''m working on a database system for > clinical trials. I''ve investigated the plugins mentioned but I wasn''t > too comfortable for many reasons, especially with the ability to > reconstruct from audit trail. > > I''m actually looking into extending the ActiveRecord.Observers are the way to go if you require this kind of functionality -- 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 -~----------~----~----~----~------~----~------~--~---