Hi Jeff,
How did you pass the userid to the trigger for auditing? Are you able to post what you did? (e.g. I intend to ‘hack’ on postgresql_adapter.rb).
I’m wondering whether for me (so having to get too deep into mysql triggers/stored procedures - if it has them, haven’t checked yet) whether an approach similar to “keeping track of who did what - Rails Receipes” would be easier. That is using a Cache:Sweeper to trigger a log statement which will have access to the session information. This could then pass the userid to a stored procedure to do the audit. I guess then this is non-DB specific and I may as well let the rails layer then write the audit information.
PS. I’m also keen on your concept of 1 audit table only, with columns to store which table/column was changed. I’m thinking of complementing this table with an action based table which captures audit from the UI point of view, e.g. “UserA performed a Contact Edit & modified X,Y,Z”. If I include the concept of a transaction number for this I could also put this into the detailed database audit table and tie to the two tables together. E.g. For a given audit action I could then look up all the database attributes that were changed in relation to this transactions. Comments anyone?