# Create 50 objects and show only them

**URL:** <https://www.ruby-forum.com/t/create-50-objects-and-show-only-them/152534>\
**Category:** Rails\
**Created:** [November 4, 2008, 11:09pm UTC](https://www.ruby-forum.com/t/create-50-objects-and-show-only-them/152534 "2008-11-04T23:09:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![medwedj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@medwedj](https://www.ruby-forum.com/u/medwedj)\
**Post date:** [November 4, 2008, 11:09pm UTC](https://www.ruby-forum.com/t/create-50-objects-and-show-only-them/152534/1 "2008-11-04T23:09:15Z")

</div>

Hello all!

Situation: user has a possibility to create variable amount number of  
objects. The number choses user himself. After creating user wants to  
see all just created objects. And only them. Not the rest.  
How can it be done?

I put all created object in an array but what then? Redirecting to the  
“index” shows all the objects in the table and my variable  
@created\_objects is after redirection no longer available.

Thanx for help!

---

<div class="post-metadata">

**Author:** ![medwedj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@medwedj](https://www.ruby-forum.com/u/medwedj)\
**Post date:** [November 4, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/create-50-objects-and-show-only-them/152534/2 "2008-11-04T23:27:23Z")

</div>

You could store the ids in an array in the session. Note: Don’t store  
the entire objects in the session just the id columns so you can look  
them back up in after the redirect.

Medwedj P. wrote:

> Hello all!
> 
> Situation: user has a possibility to create variable amount number of  
> objects. The number choses user himself. After creating user wants to  
> see all just created objects. And only them. Not the rest.  
> How can it be done?
> 
> I put all created object in an array but what then? Redirecting to the  
> “index” shows all the objects in the table and my variable  
> @created\_objects is after redirection no longer available.
> 
> Thanx for help!

---

<div class="post-metadata">

**Author:** ![medwedj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@medwedj](https://www.ruby-forum.com/u/medwedj)\
**Post date:** [November 7, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/create-50-objects-and-show-only-them/152534/3 "2008-11-07T18:10:40Z")

</div>

I solved the problem myself!

The point is: while creating Istored all the object in an array. After  
saving I did:

respond\_to do |format|  
format.html { render :action =\> ‘last\_created’ }  
end

An in the view “last\_created” I go over the entire array and show all  
the objects in a table.
