Marnen Laibow-Koser wrote in post #975923:
I would agree, especially if you're going to use this concept in a variety of circumstances. If it's just one customization on one model then I might be inclined to go the other way in some cases. Debatable.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)
Garrett Lancaster
------------------------------------------------------------------------ Marnen Laibow-Koser <mailto:[email protected]> January 18, 2011 9:12 PM Er, sorry. I changed ValueSet to Record and missed that instance.Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected]------------------------------------------------------------------------ Marnen Laibow-Koser <mailto:[email protected]> January 18, 2011 9:12 PM 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 LancasterBest, -- Marnen Laibow-Koser http://www.marnen.org [email protected] ------------------------------------------------------------------------ Garrett Lancaster <mailto:[email protected]> January 18, 2011 9:02 PMNot 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.Garrett Lancaster ------------------------------------------------------------------------ RogerM <mailto:[email protected]> January 18, 2011 8:39 AM Can anyone shed some details or point me in the correct direction? In a nutshell I am trying to get the users in my app to create and use web forms. I found a great jQuery example, I just have no idea how-to save the form structure to db then render it and saving users answers/ options to the rendered form. Roger ------------------------------------------------------------------------ RogerM <mailto:[email protected]> January 10, 2011 11:17 AM Hi Colin, sorry I am probably not using proper terminology. I have a subdomin type rails application. I am trying to get the administrator users of the subdomain account to create an HTML form, something similar to phpform.org. Roger
-- 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.
<<inline: compose-unknown-contact.jpg>>
<<inline: postbox-contact.jpg>>

