Sha256: 537831899af04fb43d2185501d56801e28c99b59245d6c62051f95a65f345312
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
= ar-audit-tracer {<img src="https://secure.travis-ci.org/verticonaut/ar-audit-tracer.png" />}[http://travis-ci.org/verticonaut/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). The new version 1.0.0 works now for Rails 3.0, 3.1 and 3.2 and is tested with Ruby 1.8.7, 1.9.2 and 1.9.3. == 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-1.0.1 | README.rdoc |
ar-audit-tracer-1.0.0 | README.rdoc |