Newbie question: Dynamic view creation from obj.to_html_form


#1

Hi. I would like to be able to generate a form dynamically from an
object’s to_html_form method, submit it, and then place marshalled
object into a database row.

Since I do not know exactly all the input fields in advance, I figure
this would allow me to dynamically create the input form, stuff the user
input into object, marshal the object into the database, and display it
later dynamically for the user to edit again.

I actually need to use the composite design model and so I will perhaps
have nested objects with form information. I should be able to marshal
and unmarshal these objects without difficulty.

How do I do this in Rails? This would be pretty cool because I could
all sorts of objects and their associated forms in the same table. I
could have a column for class name to iterate through all the same
objects that I am interested in.

Thanks.


#2

Miles Monroe wrote:

Hi. I would like to be able to generate a form dynamically from an
object’s to_html_form method, submit it, and then place marshalled
object into a database row.

Since I do not know exactly all the input fields in advance, I figure
this would allow me to dynamically create the input form, stuff the user
input into object, marshal the object into the database, and display it
later dynamically for the user to edit again.

I actually need to use the composite design model and so I will perhaps
have nested objects with form information. I should be able to marshal
and unmarshal these objects without difficulty.

How do I do this in Rails? This would be pretty cool because I could
all sorts of objects and their associated forms in the same table. I
could have a column for class name to iterate through all the same
objects that I am interested in.

Thanks.

OK, I found the “Making Dynamic Templates” section in Agile Web
Development with Rails. I think that should explain it. Has anyone
created a dynamic template?

Thanks.