I have two tables, pages and revisions. Revisions has a foreign key to a page. The contents of a page is the latest entry in the revisions table for that page. The revisions are full copies of the contents, no deltas.
As an experiment, I would like to visualize the revision state of the current revision. If text is new in the current revision, don't do anything. If it is from a recent revision, give it a green background color. If it's very old, give it a red background color. In between, orange. A heat map diff of the age of the content, so to speak.
My question is: How I can extract this data from the revisions of a page? Pointers to literature would be equally useful to actual code solving this problem.
Not really relevant, but just in case: It's for a Ruby project, Ruby on Rails in fact. Here's the project, on github.
Update: here's an example test case, written in Ruby. http://pastie.org/631604