Anyone out there really familiar with acts_as_versionable ? I''ve recently got it working, and I think it''s working great. But what I want to do is a little different than what it does by default. Currently, each time I save the activerecord, the plugin increments the version number in the main table, and writes a copy to the table that stores old versions. What I''d like to be able to do is have prospective versions that are not the current one, but are a higher version number than the one stored in the main model table. Basically I am trying to add a system where changes to records create a new version, and are merged and approved before they become "active". I could build a separate system to hold the prospective versions (it would be very similar to acts_as_versionable) - and then do the merge and keep acts_as_versionable unchanged... but it would be great if I could do this with the plugin now. Anyone else done anything like this? Regards, Jonathan
Benjamin Curtis
2006-Jul-11 15:54 UTC
[Rails] acts_as_versionable and prospective versions
You might find this plugin, http://agilewebdevelopment.com/plugins/ acts_as_draftable, also from Rick Olson, helpful. -- Benjamin Curtis http://www.bencurtis.com/ http://www.tesly.com/ -- Collaborative test case management http://www.agilewebdevelopment.com/ -- Resources for the Rails community On Jul 11, 2006, at 8:44 AM, Jonathan Dugan wrote:> Anyone out there really familiar with acts_as_versionable ? > > I''ve recently got it working, and I think it''s working great. > > But what I want to do is a little different than what it does by > default. > > > Currently, each time I save the activerecord, the plugin increments > the version number in the main table, and writes a copy to the table > that stores old versions. > > What I''d like to be able to do is have prospective versions that are > not the current one, but are a higher version number than the one > stored in the main model table. Basically I am trying to add a system > where changes to records create a new version, and are merged and > approved before they become "active". > > > I could build a separate system to hold the prospective versions (it > would be very similar to acts_as_versionable) - and then do the merge > and keep acts_as_versionable unchanged... > > but it would be great if I could do this with the plugin now. > > > Anyone else done anything like this? > > > > Regards, > Jonathan > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/5a97371f/attachment-0001.html
On 7/11/06, Benjamin Curtis <rails@bencurtis.com> wrote:> > You might find this plugin, > http://agilewebdevelopment.com/plugins/acts_as_draftable, > also from Rick Olson, helpful.It would work, but each draft is only versioned once. If you do a lot of edits before making your change live, it might be better to add some simple #save_new_version method to acts as versioned. It would create the new version, yet keep the record''s version the same. When you''re ready to make a change live, then simply call revert_to. @article.create(...) # version 1 @article.save_new_version # saved to version 2 @article.version # => 1 @article.revert_to! 2 If you can work up a little patch with unit tests, I''d be happy to include this in acts as versioned. I''m guessing that 90% of it is done anyway. -- Rick Olson http://techno-weenie.net