ruby on rails - Is there any way to see when my attribute was set? -


without adding more columns db , doing callbacks, there way (rails-y or otherwise) can see when attribute set on object?

postgres keep column-level statistics, updated when analyze done or auto-analyze occurs. these include things most common values , histogram bounds.

however, these column whole, across rows. if want have information individual row's columns, you'll need add either additional rows table, or create table (or several) store additional information, , in either case update tracking information accordingly.

these types of audit trails can automated degree use of trigger functions examine what's being changed, , if 1 of columns you're interested in has changed, can automatically update timestamp (if inline in table) or insert row in audit table(s).

however, there not built in @ granularity @ appear looking.

if looking 1 or handful of attributes, adding column inline table , updating (in insert/update themselves, or via trigger function), best bet.

if looking more systemic, i.e. want know all columns in bunch of tables, more full-fledged auditing system implemented via trigger functions , stored in separate tables better bet.


Comments