Model for Tracking changes

Hi!

I’m new to Rails (and ruby in general). I was planning to implement a
whiteboard like system, in which changes made by users to the board are
automatically tracked.
Currently, I’ve implemented it as a model Post which :has_many Boards. A
new Board is added to the Post every time a change is submitted (with a
created_at timestamp). This allows saving multiple versions of the
board, but has the drawback that:
a) The board is replicated even if there is only a marginal change.
b) There is no easy way (I know) to diff two versions.

Would be very grateful it anyone could help me out with some better
model or point me in the right direction.

Yours,
Chinmay

On 3/6/06, Chinmay K. [email protected] wrote:

b) There is no easy way (I know) to diff two versions.

Would be very grateful it anyone could help me out with some better
model or point me in the right direction.

Yours,
Chinmay

You can try installing my acts_as_versioned plugin:
http://ar-versioned.rubyforge.org (Use the plugin version instead of
the gem).

The Rails Recipe book has a great intro recipe on how to use it too.

It still saves revisions for small changes, but you can specify which
fields to check with:

class Post < AR::Base
acts_as_versioned :if_changed => [:title, :body]
end

You can also save without a revision:

@post.save_without_revision

Diffing isn’t included, but you can look at the i2 source to see how
the Rails Wiki handles it:

http://dev.rubyonrails.org/svn/tools/i2/trunk


Rick O.
http://techno-weenie.net