Insert multiple records to a single table from a single form

Generally if we can create only 1 record, say 1 user at a time from the
form. But what if I want to create multiple users from a single form?
There
are no associations with other models. How can i do that?

abhimanyu bv wrote in post #1075325:

Generally if we can create only 1 record, say 1 user at a time from the
form. But what if I want to create multiple users from a single form?
There
are no associations with other models. How can i do that?

What is preventing you from doing that?
What have you tried?
What is your basis for this idea that you can only create a single
record at a time?

Yes, the typical case (used by standard scaffolding for instance) uses a
form to create a single record at a time. Most of the time that makes
sense given that each record is different.

However, there’s nothing stopping you from building whatever user
interface you want. There are many possibility for building something
like what you want. We’re not here to design your app for you. If you
have a specific problem we can probably provide you with helpful
answers.

That being said. If I were to build something like this I’d probably use
some JavaScript to add new records one at a time by submitting them in a
background request and use a very standard controller “create” action.
Using JavaScript you can “hide” this behavior from the end users and
make it appear to them as if they are adding multiple records from one
view.

I’d probably still have a single form on the to provide an area to enter
the information for a single record. I’d also probably use some sort of
“in-place editor” to allow the user to go back and edit any record
listed on screen or add a new record.

Hopefully that will give you some direction, but it’s really up to you
to design a solution that fits your specific needs. Don’t fall into the
trap that what scaffolding provides is the only way to do it. In fact
once you get past the very basics of learning Rails you’ll probably
seldom ever use scaffolding again.

For an example of how to build an excellent user interface take a look
at the design of PivotalTracker. AFAIK that site is built entirely with
with Rails (with maybe some other stuff thrown in). While there, notice
how different its UI is from a basic scaffolding app.

To see a video demo visit: