Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean Paper Trail Versions #212

Merged
merged 6 commits into from
Jul 31, 2013
Merged

Conversation

seanmarcia
Copy link
Contributor

Hey guys the current system of deleting old versions wasn't very useful for our purposes on a CMS. Our university users use versions to maintain and switch between different sites depending on the time of year. For example during the spring, they reverted to the convocation page (and possibly make minor changes), after convocation they put their page up for welcoming new students in the fall and so forth. So just deleting versions older than a certain date isn't practical.
What this PR enables is it cleans up any excess versions and just leave the last one that happened on any given single day. The theory being that when someone makes changes, they will make a lot in the tweaking process but they are only concerned with the last one.

To run the command:

PaperTrail.clean_paper_trail_versions

@batter
Copy link
Collaborator

batter commented May 22, 2013

@seanmarcia - Sorry for the delayed response on this. Do you think we could refactor this a bit to provide flexibility to allow for variable version limits instead of just 1? I want to try to pull the logic behind this in, however, I feel like it has a very narrow use case as it stands.

@seanmarcia
Copy link
Contributor Author

Sounds good. I'll submit a new PR that accepts variable limits.

@batter
Copy link
Collaborator

batter commented May 28, 2013

@seanmarcia - Please take a look at dbb4f28 and see if this commit (Adding an option to limit the # of versions stored) might suffice for this type of thing or somehow go hand in hand with your idea. Just trying to merge this idea in in a thoughtful manner.

…hod the option of passing in a value. Also created a keep versions method that keeps the specified number of versions.
@seanmarcia
Copy link
Contributor Author

Sorry about so slowly following up with this some unexpected travel came up.

I updated the cleaning to accept a variable, or if none is passed to default to one.

@batter
Copy link
Collaborator

batter commented Jul 30, 2013

Hey @seanmarcia, apologies again on the delayed response on this, it's been a busy summer. I'm working on merging this now, but I'm going to make an attempt to condense the code a bit for readability sake. I'm also trying to add a bit of flexibility in allowing for individual dates to be specified.

I think this might be a niche / uncommon use case, but hopefully someone else will find this type of thing useful.

@batter batter merged commit c480b5b into paper-trail-gem:master Jul 31, 2013
@batter
Copy link
Collaborator

batter commented Jul 31, 2013

@seanmarcia - As I mentioned yesterday, I took some time to revise and refactor your Cleaner module. I also gave the method that invokes the cleaning additional configurable options to make it more flexible. It has now been merged and pushed into the master branch. Let me know if you have any comments or questions, but I think the code condensation I performed makes it a little bit more readable, and the optional options argument makes it a lot more flexible. I hope you approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants