Forum: Ruby on Rails Newbie question: Dynamic view creation from obj.to_html_form

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.
Miles Monroe (Guest)
on 2006-03-28 08:12
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.
Miles Monroe (Guest)
on 2006-03-28 11:24
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.
This topic is locked and can not be replied to.