ERB: <%= hidden_field_tag(''users_ids'', @users.collect(&:id))%> OUTPUT: <input id="users_ids" name="users_ids" type="hidden" value="127101520242526273035394142555772737479838593101104117121127128132133136143149162169170177181184187190198200203205206223226227228235238245246250254255260264265269270277279286288292298306310312314316323327329333335338345362365366367380384385386397399406408410415420423427429430438441442444446447452461466468473477483484492493499503506518519520531533536537539548553556560574581585586588602605614616623627630631633641644645647649650653655662666669670671680681683687689691693698702706712719720727746750753758759761766768771773774777778779780781782783786787789793805811813816817829830831835842847848851854855862863864869874877882886896899904908909914919920922933934945950959966967968973976977979981985986989991994996997" /> I want to grab an array of user ids and then do something with them, but hidden_form_tag is flattening my array. I''ve tried various ways of putting an array into h_f_t and it always flattens it. How can I preserve the structure of my array? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try this: <% for user in @users %> <%= hidden_field_tag "user_id[]", user.id %> <% end %> - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Sat, Jan 10, 2009 at 8:35 PM, Taylor Strait <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > ERB: > <%= hidden_field_tag(''users_ids'', @users.collect(&:id))%> > > OUTPUT: > <input id="users_ids" name="users_ids" type="hidden" > value="127101520242526273035394142555772737479838593101104117121127128132133136143149162169170177181184187190198200203205206223226227228235238245246250254255260264265269270277279286288292298306310312314316323327329333335338345362365366367380384385386397399406408410415420423427429430438441442444446447452461466468473477483484492493499503506518519520531533536537539548553556560574581585586588602605614616623627630631633641644645647649650653655662666669670671680681683687689691693698702706712719720727746750753758759761766768771773774777778779780781782783786787789793805811813816817829830831835842847848851854855862863864869874877882886896899904908909914919920922933934945950959966967968973976977979981985986989991994996997" > /> > > > I want to grab an array of user ids and then do something with them, but > hidden_form_tag is flattening my array. I''ve tried various ways of > putting an array into h_f_t and it always flattens it. How can I > preserve the structure of my array? > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maurício Linhares wrote:> Try this: > > <% for user in @users %> > <%= hidden_field_tag "user_id[]", user.id %> > <% end %> >This worked perfectly. Thank you. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---