Pass an Array of Arrays from view to controller


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

<% a1 = %>
<% a2 = %>


<% 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?


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, “[email protected][email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs