# Can I use the "scaffold" command to have multiple objects on my page?

**URL:** <https://www.ruby-forum.com/t/can-i-use-the-scaffold-command-to-have-multiple-objects-on-my-page/127159>\
**Category:** Rails\
**Created:** [January 25, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/can-i-use-the-scaffold-command-to-have-multiple-objects-on-my-page/127159 "2008-01-25T16:37:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 25, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/can-i-use-the-scaffold-command-to-have-multiple-objects-on-my-page/127159/1 "2008-01-25T16:37:53Z")

</div>

I am familiar with how to use scaffold to generate a view where I can  
create an object. What I would like to do is have a view where I can  
create multiple of the same object, say five of them. How can I do  
that?

Thanks, - Dave

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 25, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/can-i-use-the-scaffold-command-to-have-multiple-objects-on-my-page/127159/2 "2008-01-25T17:59:34Z")

</div>

removed\_email\_address@domain.invalid wrote:

> I am familiar with how to use scaffold to generate a view where I can  
> create an object. What I would like to do is have a view where I can  
> create multiple of the same object, say five of them. How can I do  
> that?

Write your own view. Have one form with separate fields for each of the  
five objects. So instead of model[field] you have model[1][field]  
through model[5][field]. Iterate through params[:model] in your create  
action to create multiple objects.

Jeremy

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 25, 2008, 6:16pm UTC](https://www.ruby-forum.com/t/can-i-use-the-scaffold-command-to-have-multiple-objects-on-my-page/127159/3 "2008-01-25T18:16:07Z")

</div>

Much obliged for this info. On the controller end, how would I get  
those objects from the params variable and save them? The object is  
called line\_item and the two attributes are “item\_number” and  
“comments”.

Thanks again, - Dave

On Jan 25, 10:59 am, Jeremy E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
