Forum: Ruby on Rails versioning and dynamic object properties

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C721ced53ba4b6d86a6a0b3284febc76?d=identicon&s=25 Stephyn Butcher (stephynb)
on 2005-11-19 18:58
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
B6e90ad1e69d563f1f13cccffe137262?d=identicon&s=25 Simon.Santoro (Guest)
on 2005-11-19 19:48
(Received via mailing list)
Stephyn Butcher 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/HowToWrite...

> 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.
This topic is locked and can not be replied to.