# Pass an Array of Arrays from view to controller

**URL:** <https://www.ruby-forum.com/t/pass-an-array-of-arrays-from-view-to-controller/135996>\
**Category:** Rails\
**Created:** [April 27, 2008, 8:06pm UTC](https://www.ruby-forum.com/t/pass-an-array-of-arrays-from-view-to-controller/135996 "2008-04-27T20:06:29Z")\
**Posts on this page:** 2\
**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:** [April 27, 2008, 8:06pm UTC](https://www.ruby-forum.com/t/pass-an-array-of-arrays-from-view-to-controller/135996/1 "2008-04-27T20:06:29Z")

</div>

Hi,

is there a way to pass a Array of Arrays in params? I tryed like this:

\<% a1 = Array.new %\>  
\<% a2 = Array.new %\>

[…]

\<% a1 \<\< a2%\>

[…]

\<%= link\_to\_remote ‘next’,:url =\> {:controller =\>  
‘myController’, :action =\> ‘myAction’, :params=\>{:myArray =\> a1 }} %\>

But i can’t access the nested Array. A Array of Integer or Strings is  
accessible. Has someone an advice?

regards

---

<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:** [April 27, 2008, 10:30pm UTC](https://www.ruby-forum.com/t/pass-an-array-of-arrays-from-view-to-controller/135996/2 "2008-04-27T22:30:06Z")

</div>

You aren’t sending a key with the value to the params hash when you  
nest arrays as in your example. If you send a hash holding both parts  
of your array you may have better luck.

For example:  
myhash = {:a1 =\> [1,2,3], :a2 =\> [4,5,6]}  
… params =\> { :myarray =\> myhash } …

On Apr 27, 9:05 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
