Sha256: ddaf79e7da669ea0aca23258d9c867ba06fdcbe1e142845e54c1c969a6b04909

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

= ar-audit-tracer


== Summary

<i>ar-audit-tracer</i> patches ActiveRecord so modifiers of a record can be traked on saving (insert/update).
It works exactly like 'timestamps' (see usage below).


== Usage

=== Migration

In a models migration add:
  t.authors
  
This will add columns +created_by+ and +updated_by+ of type +:string+ to your model.

In case you want to use another type, simply pass the type as argument, e.g.
  t.authors(:integer)

=== Usage

All you need to do is to set the current author such as e.g:
  Concern::Audit::Author.current="bad_man"

Each ActiveRecord +save+ or +update+ then will set the respetive attributes +created_by+ and +modified_by+ automatically, whereas the modifier is set to the same value as the creator on model creation.

In a Rails Application you would set the author as described above in a +before_filter+.
+Concern::Audit::Author+ stores the author in a Thread-Local variable.

== Additional Notes
In case you need associations to a respective Author Model you have to set them up yourselfs.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar-audit-tracer-0.2.0 README.rdoc
ar-audit-tracer-0.1.0 README.rdoc