Dynamic forms

There are two types of approaches. Generating things like migrations
and model classes for data storage is generally not "dynamic" but can
be generated by code. It is more common to use a more generic schema
for data storage and dynamically create the presentation. This would
be more "dynamic" as the behavior is changing at run-time rather than
design-time. I am not sure which approach you were asking about.

Who are your users? Are they HR people that are not programmers? If
this is the case you definitely do not want to be changing the
database schema at run-time unless you really know what you are
doing. There are a lot of issues with modifying a production database
schema that end-users will not be able to cope with. If you are
targeting programmers then are you looking to help them during
development or after deployment?


I've done something similar to this and got it working however I'm
unsure if my solution was truly the best way as I realized quickly it
was over kill.

But basically I did it like this

Data Table that stored hashes of various datatypes as well as a field
that told me what type of data was being stored.

Then I had a Forms Table and a Forms Attributes table

Forms can have many attributes and attributes.

Then I could get to it like

Forms.attributes.collect { |a| a.datum.data }

look into the serialize method of rails for storing multiple datatypes
for the form attributes.

Of course you can add new fields and such by adding them to a "form
instance" etc.

This is all just REALLY general information, but it could help you
along, since I had written quite a bit of code before I abandoned it
for a much more "hard coded" approach and the project was scaled down
and dynamic forms were removed for the sake of me wanting to have a
project finished before the end of the year.

Good luck to you,