Versioning and dynamic object properties

Dear list,

I’m doing some investigative inquiries into how difficult it would be to
develop a project I’m working on using ROR instead of Java+Frameworks.

I’ve done a few of the tutorials and I think I have a good feel for how
ROR would handle the run of the mill webapp stuff. I do, however, have
one requirement that is unusual and I was wondering what
anyone’s/everyone’s take on how difficult this would be to implement in
ROR and how one might go about doing it.

The first unusual requirement is for user configurable properties for
certain business objects. I cannot foresee every possible field that
Customer A might want for Employee records which will probably differ
from Customer B so I give them the ability manipulate the database using
an admin UI. There they can create new fields such as Birthday, Favorite
Color, etc. using information from a Properties_Definition table. System
information about employees is also stored there as well (Name, etc)
which permits them to customize the display label for things like
Employee No. which may not be called “Employee No.” for them.
Additionally, they can customize drop down lists such as Favorite Color.
I’m wondering how difficult, in the context of ActiveRecord, this would
be to implement in Rails.

The second unusual requirement is versioning. If I edit an Employee’s
Employment record, I don’t want the new information to overwrite the old
information, I want a new record with the appropriate version number to
be created. Again, given the structure of the framework, I’m wondering
what would be involved in implementing this in Rails.

Any information, suggests, sketches, examples would be greatly
appreciated.

Cheers,
Steve

Stephyn B. wrote:

I’m wondering how difficult, in the context of ActiveRecord, this would
be to implement in Rails.

I would write an act_as plugin for this. You could store all your custom
fields in a 1:1 table and add the fields to your model query.
http://wiki.rubyonrails.com/rails/pages/HowToWriteAnActsAsPlugIn

The second unusual requirement is versioning. If I edit an Employee’s
Employment record, I don’t want the new information to overwrite the old
information, I want a new record with the appropriate version number to
be created. Again, given the structure of the framework, I’m wondering
what would be involved in implementing this in Rails.

This is not really an inusual request, since someone already wrote a
plugin for this, that you can use out of the box:
http://ar-paranoid.rubyforge.org/
This plugin makes does not allow the deltion of a record, but set a
deleted_at field, and find is overloaded to skip deleted records.