Project

trackzor

0.0
No commit activity in last 3 years
No release in over 3 years
Track ATTR_updated_at and ATTR_updated_by
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Setup¶ ↑

Add “trackzored” to your model. By convention, any attribute that also has [ATTR]_updated_at or [ATTR]_updated_by will be maintained. You can optionally specify :only and :except if this convention steps on your toes – :except => :status would skip the check and update of status_updated_at and status_updated_by. If [ATTR]_updated_by is present, it is required by a validator. If acts_as_audited is present, trackzor-maintained columns will be added to non_audited_columns to prevent double-auditing.

Use the trackzor_migration generator to quickly add columns:

script/generate trackzor_migration User email phone_number

This will create a migration for adding email_updated_at, email_updated_by, phone_number_updated_at, and phone_number_updated_by columns.

Usage¶ ↑

To set the current user:

Trackzor.as_user(user_obj) do
  ...
end

Or, if you’re also using acts_as_audited, its as_user method is supported:

Audit.as_user(user_obj) do
  ...
end

For each trackzored [ATTR]_updated_by column, a belongs_to association (:[ATTR]_source) is added to link to the user.