Enable Logging

The Enable Logging plugin extends ActiveRecord? and ActionController? to automatically log all changes to your model. It uses a polymorphic association to store an audit record for any change of any model objects that you wish to have audited.

Installation

You need to activate enable_logging in the Model and in the controller, if you want the current user to be set in the LogEntries?. If you just set enable_logging in your model, no LogEntry? will have a user record attached.

Dependencies

Logging the right user via ActionController? depends on the caching of rails. Therefore you need to activate caching in your environment. It is disabled by default in the development-environment. To change that, edit config/environments/development.rb and set:

  config.cache_classes = true
  config.action_controller.perform_caching = true

Tutorials

  • Tutorial - Extend the Agile Web Development with Rails Shop Application with Logging.

Resources