# Rules for passing arrays between requests

**URL:** <https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696>\
**Category:** Rails\
**Created:** [July 18, 2007, 12:46am UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696 "2007-07-18T00:46:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 18, 2007, 12:46am UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696/1 "2007-07-18T00:46:47Z")

</div>

i currently have a feature on my application that requires an array  
persist over multiple requests. i originally put it in a session var  
and deleted it when i was done. this was great but i got to thinking  
it might be better resource-wise to pass it as a paramenter. problems  
arise when a redirect\_to takes place. is it possible for a redirect\_to  
to post instead of get (it seems to not be possible according to the  
docs). is there some other way or is the session approach best? thanks  
in advance.

-mike

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 18, 2007, 4:01am UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696/2 "2007-07-18T04:01:11Z")

</div>

why would you think a redirect\_to would cause a problem with the data  
stored in the session?

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 18, 2007, 4:38am UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696/3 "2007-07-18T04:38:25Z")

</div>

hi chris,

i probably didn’t explain myself well. i meant to say this…

i need to have an array that persists across multiple requests.  
originally i accomplished this by storing the array in the session  
until i was done with it then i deleted it. i decided that that was  
slightly cumbersome and possibly not efficient resource-wise. so i  
tried not storing it in the session at all but instead passing it  
along as a parameter via hidden form fields and query strings (with  
redirect\_to) but it seems to not work well because when it’s passed as  
a query string rails doesn’t recognize it as an array anymore. i was  
wondering if maybe you can make redirect\_to POST instead of GET cause  
then it seems i could pass my array in params without having to  
convert it from a string back to an array in the controller. i figure  
i’m either missing something big or small or i was on the right track  
originally when i used the session approach. what do you think?

peace,  
mike

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 18, 2007, 11:32am UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696/4 "2007-07-18T11:32:13Z")

</div>

No that I am an expert, but I would stick with sessions rather than  
expose your data to the users, which may raise potential security  
issues.

Andrew

On Jul 18, 12:37 pm, “Michael Bannister” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 18, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/rules-for-passing-arrays-between-requests/109696/5 "2007-07-18T12:35:23Z")

</div>

> > i need to have an array that persists across multiple requests.

that is the whole purpose of sessions.
