how to pass info external to model to after_create callback

I've got a situation where i have a model that whenever something
changes i want to drop a row in another table (audits) to indicate
that the record changed and who changed it. currently whenever i save
the data i make a call to the models audit method and pass in a User
object.

keep in mind that the model i am auditing does not reference a user,
which is why i have to pass in the User object to the audit call.

anyways, i want to add after_create and before destroy callbacks to
the model but I am hung up on how to pass the User object via the
callback.

Chris

Chris,

Take a look at the documentation on observers:

http://api.rubyonrails.org/classes/ActiveRecord/Observer.html

You may find this helpful, especially if you want to have an audit
trail on more than one table. You can pass the user to the model
using Thread.current:

Thread.current[:user] = your_user

The Rails Recipes book has an audit trail recipe ("Keeping Track of
Who Did What") that uses a cache sweeper that may give you some ideas.

Aaron