Create 50 objects and show only them


#1

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!


#2

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!


#3

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.