vestal_versions
vestal_versions copied to clipboard
Full history of a model
The other day I was using vestal_versions, and I wanted to display a page with all the titles a post had had since its creation. So, I basically needed an array of post objects, each of them belonging to a revision.
I ended up writing this method in my model:
def revisions versions.collect do |version| revert_to(version) self.clone end end
Then I thought that it might be interesting to have it inside the plugin. So, in case you (or someone else) is interested, I share the idea.
Regards, and thanks for this very useful gem.
Javier,
Great idea! I'll get that or something similar into 1.0. Thanks,
Steve
Version 1.0 was just released. I'm still considering adding this functionality, but it hasn't been included in 1.0 just yet. Stay tuned!
Hi, the code on top would not show the initial revision. My shot for complete history - http://gist.github.com/347049