Thanks, Rick, for a great plugin. But one thgn leads to another, sort
of like pulling at the thread in the willy jumper … 
Three questions about acts_as_versioned; the second leads to other
issues.
-
use of :sequence_name
is this the “order_by”? How is this going to be different from
using the ‘:version_column’ to order the
revisions.
-
Derived from (1).
If I have a ‘:version_column’ set and I want optimistic locking
as well, how do I do that?
-
I’m very unclear about using ‘:extend’ or the “acts_as_versioned
do … end” construct.
Obviously I want to be able to reference any revision of the Page and
any field or method:
… something
page.revision(rev_no).title = “Hello World”.reverse
page.revision(rev_no).updated_at.suc === page.updated_at
display = page.revision(rev_no).render_content_to_html
If I wasn’t using acts_as_versioned and was doing this with an
explicit revision table
I’d be writing thigns like
class Page < ActiveRecord::Base
has_many :revisions
has_one :current_revision, :class_name => 'Revision', :order =>
‘rev DESC’
but I’d really like to DRY and not have to have a separate Revision
model.
Any input or examples would be appreciated.
On 12/8/07, AntonAylward [email protected] wrote:
revisions.
This is some postgres thing, you can probably ignore it on other
databases.
- Derived from (1).
If I have a ‘:version_column’ set and I want optimistic locking
as well, how do I do that?
I think you just set the version column to lock_version. I’ve never
used optimistic locking, so it may need some patches to get working
correctly. Feel free to contribute if you do this.
- I’m very unclear about using ‘:extend’ or the “acts_as_versioned
do … end” construct.
It’s similar to the :extend or block syntax of ActiveRecord
associations, only it defines the methods on both the current class
and the version class. For instance in Lighthouse (my Rails based
ticket tracker app), Ticket comments are really just versions of the
same ticket. But, I want the Ticket::Version model to quack like a
Ticket, so I add a lot of methods and associations inside the
acts_as_versioned block.
explicit revision table
Any input or examples would be appreciated.
acts_as_versioned creates another class for you. Check out the code
(http://projects.wh.techno-weenie.net/browser/plugins/acts_as_versioned/lib/acts_as_versioned.rb),
it sets up a versions association. You can define helper methods to
access them by version # if you want. I suppose the current way would
resemble:
@page.versions.find_by_version(234)
–
Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com