goobelz-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2008-Apr-27 18:05 UTC
Pass an Array of Arrays from view to controller
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
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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, "goob...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org"
<goob...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---