Forum: Ruby on Rails How can form data be used to make an XML file?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Rock R. (Guest)
on 2008-10-16 00:45
I have a scenario. Ignore this if it is silly. I have a form like a data
entry. It has 3 fields which are name, age and gender. The guy who
enters the data adds more fields with the help of an Add another Entry
link which brings a set of the 3 fields with the help of a partial which
has the form with 3 fields. After he finishes all the entries he Submits
which must generate an XML file which will be saved in the file system.
My question is how to pass the set of entered data to create the XML.
XML can be built using XML builder function and file can be saved. But i
need to know how this data can be passed to the controller for XML
generation. Please help. Thank you
Rock R. (Guest)
on 2008-10-16 00:47
The XML would be for example

   <student name="Mark" age="25" gender="Male"/>
   <student name="Sarah" age="25" gender="Female"/>
Freddy A. (Guest)
on 2008-10-16 05:14
(Received via mailing list)
Why don't you just save the data to the database and serve it as xml
when the xml is needed? This way you can do more than just xml with
the data?

If that's not an option you can setup a session model that can store
the data when it comes back to the controller... Just setup form_tags
that has student_1 student_2 ... and save the data one by one...

I'm thinking student_form has_many students and just use the
This topic is locked and can not be replied to.