简体   繁体   中英

Tracking history of a model and all the associated models to it in Rails

Recently in one of my projects I was required to add functionality to track all actions(create, update, delete), redo and undo to some models. In the project I am using Mongoid as a ODM. I can add most of these functionalities with mongoid-history. But mongoid-history can not track referenced relations. In my case I have Building model which has_many locations. When I update a location from building form(as nested attribute) then mongoid-history adds appropriate track(document) to history tracker collection but this document is not get related with the building object. Therefore when I call @building.history_tracks I can not get this history track. What would you suggest? Or am I doing something wrong?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM