This module wires Rails to store the user that created and last-updated an ActiveRecord model.
class Model < ActiveRecord:Base
who_dunit # Enable saving of created_by and updated_by
end
class ApplicationController < ActiveController:Base
who_dunit # Enable tracking of current user
end
## TODO Write migration example
In ApplicationController:
- around_filter stores the current user in current thread for the duration of the action ** current user stored in thread-local variable
In Model:
- has_one association to user for 'created_by'
- has_one association to user for 'updated_by'
- before_create calback sets 'created_by' column
- before_save callback sets 'updated_by' column
In Migrations: