ES,

You really can't do that as you have described because each controller
method represents a different http request and a brand new instance of the
controller is created.  So an array that is saved in a previous request
won't be available in a subsequent request.  To accomplish what you want
will require persisting the information from previous pages.  Some possible
solutions...

1) Save the previous values in hidden form variables each step along the
way.
2) Save the previous values in a session variable.
3) Save the previous values in flash and use the keep method to maintain
them between requests.
4) Use some sort of cache like memcached.

I hope this helps.

Anthony Crumley
http://commonthread.com

On Fri, Apr 9, 2010 at 3:45 AM, ES <[email protected]> wrote:

> I would like to have an array saving fields to display for an object
> that is used for its form on multiple pages.
>
> I have declared the array in each of the controller methods that would
> use it.  Where can I put the array so that I only have to define it
> once and then use it repeatedly on different pages?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to