Comments (3)
Tracks let you get the original and the modified version.
track = post.history_tracks.first
track.original # {}
track.modified # { "title" => "Test", "body" => "Post", "comments" => [{ "_id" => "575fa9e667d827e5ed00000d", "title" => "test", "body" => "comment" }], ... }
I think it'd be great to add a helper []
method to find one at a specific version, I'd like something like post.history_tracks[22]
, post.history_tracks.versions[22]
, or post.history_tracks.find(22)
to work. Want to give it a shot?
from mongoid-history.
Tracks let you get the original and the modified version.
Thanks. This will give me the original value of changed fields. So to get the whole collection with all its fields, I'll need to loop over the tracks and form the collection, right?
I like the helper method suggestion, I'll try to find some time on weekend and work on it.
from mongoid-history.
Thanks. This will give me the original value of changed fields. So to get the whole collection with all its fields, I'll need to loop over the tracks and form the collection, right?
Are you trying to find a state for multiple records? I think some helper methods for that, even if inefficient, could be awesome, e.g. Post.all.at(timestamp)
, etc.
from mongoid-history.
Related Issues (20)
- Restrict dependency failure does not prevent history entry creation
- Unable to Contribute HOT 1
- undefined method `[]' for #<..::EmbedsMany> HOT 7
- Compatibility with Mongoid 7 HOT 4
- Specs create classes and are order-dependent
- Fix undo and redo modifier on embedded create/destroy
- Fix inheritance of history_trackable_options HOT 4
- Changing collection breaks history tracking HOT 5
- Release v. Next HOT 1
- `HistoryTracker` documents not created if `track_create` set to `false` HOT 2
- undefined method `collection_name' for nil:NilClass Did you mean? collectionize error coming HOT 6
- History tracker recording undo action as the last change.. HOT 1
- wrong number of arguments HOT 14
- Adding custom attributes before save HOT 1
- A tracker on an embeds_many relation is being limited by the parent configuration HOT 1
- Embeds many tracking fails if original value is `nil`
- How can we track changes done with set method? HOT 1
- It should not warn about `Overwriting existing field version` when `track_history` is called more than once
- Is it possible to specify a max number of history_tracks to maintain for each document? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoid-history.