mongoid-history icon indicating copy to clipboard operation
mongoid-history copied to clipboard

Feature: Ability to group changes

Open ajsharp opened this issue 10 years ago • 5 comments

It would be very useful to be able to group a series of small updates / changes into a single changeset. Presumably a changeset would be determined by the same modifier making a group of updates in a continuous time period. Has this been discussed before?

ajsharp avatar Jan 04 '16 22:01 ajsharp

It hasn't. Do you have a good story where you think this is useful?

Personally, I think the history records always wants to correspond to a single write, otherwise I would try to do multiple assignments to a record then call .save! in my own code to the record.

dblock avatar Jan 05 '16 11:01 dblock

Yea, you could certainly argue that this is more of a presentation / reporting concern. The use case is you do a bunch of small updates, and then in the UI, you want to show all of those updates grouped together -- "Alex updated this record with these 9 changes" -- and you view the details of the changes made.

ajsharp avatar Jan 05 '16 16:01 ajsharp

I think it could be nice. For example:

instance.track_history do
 # changes go here
end
# changes combined into a single one

That would accumulate the changes. Need to figure out what to do with redo!, undo! and what not.

dblock avatar Jan 06 '16 15:01 dblock

Maybe it's more of a reporting concern than a tracking one? My use case wouldn't allow for capturing the changes in a block like that -- they happen every time a form field is blurred.

ajsharp avatar Jan 06 '16 17:01 ajsharp

Maybe. Everything in a block can be unwrapped of course.

dblock avatar Jan 06 '16 17:01 dblock