Closed adas172002 closed 1 year ago
Let's see.
The expected behaviour should be similar to the following code:
production = Production.find(42)
production_v1 = production.at(version: 1)
decision_v1 = production.decision.at(time: 1678288950545) # the timestamp of the v1 log for production
The decision object has a timestamp equal to 1678289208579 == '2023-03-08 10:26:48 -0500', while 1678288950545 == '2023-03-08 10:22:30 -0500'. So, decision_v1 must be nil.
I think, if you set Logidze.return_self_if_log_data_is_empty = false
, it would work as expected.
Probably, we should make this behaviour a default for associations.
Hi @palkan it works as you described. Thanks for your support.
Hi,
I am trying to set versioning of belongs_to relation between Production and Decision models, both with
has_logidze
macro. I created a new Production without Decision, then updated Production with a fresh Decision instance, so myproduction.log_data
right now looks like this:and production.decision.log_data
I expect that getting
production.at(version:1).decision
should givenil
, but I am getting same instance of Decision as forproduction.at(version: 2).decision
. Am I missing something?