16470: Fixes false unpersisted status when retrieving a record with audit logs.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Tue, 28 Jul 2020 19:16:29 +0000 (16:16 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Fri, 7 Aug 2020 14:54:35 +0000 (11:54 -0300)
commit752845cfd9355b1d207f3c876de28ba07f9d1883
tree2302f05728a5de77f003d2c2b9c77f7825164bca
parentf04932adddab98b004c770a650e13d5001207e96
16470: Fixes false unpersisted status when retrieving a record with audit logs.

The cleanest solution I came up with is to flag the instance when it's
retrieved from the database, and reset any changes after stashing its
state on the log_start_state callback.
Haven't found a way to read the serialized attributes without making
them appear as changed, and I think it isn't possible because the
attributes have to be unserialized before the read operation, and thus
the dirty state machinery would assume the attribute may be modified.
This solution isn't ideal, but I think it's acceptable as it doesn't
make additional database requests.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
services/api/app/models/arvados_model.rb