Garrett Lancaster wrote in post #975922: > Not sure if it's the best way, but here's an idea. For each custom form, > use some combination of serialized db fields (one to hold the form > meta-data (field-types, field names, etc.) and a corresponding field to > hold the data.
If you're using a relational database, I think it would actually be better to have Form, Field, ValueSet, and Value models (and associated tables): class Form < AR::B has_many :fields has_many :records class Field < AR::B belongs_to :form has_many :values class Record < AR::B belongs_to :form # maybe belongs_to :user or something has_many :values class Value < AR::B belongs_to :field belongs_to :record (Record is my ad-hoc term for one user's response, filling in all form fields. There may be a better name. Also, some :throughs in there may make life easier, depending on the use case.) This might be a good candidate for a non-relational solution such as MongoDB. > > Garrett Lancaster Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

