Get Params Hash with values as nested arrays - Rails template -


i params new template create action in nested array format. eg. trying build excel kind of form. have 3 main headings feelings, questions, events feelings , events have 5 columns each , events has 1 column events data in array of 5 hash elements want feelings , questions data nested array of 5 hash elements event = [{obj1},{obj2},{obj3},{obj4},{obj5}] want feelings , questions [[{obj1},{obj2},{obj3},{obj4},{obj5}],[{obj1},{obj2},{obj3},{obj4},{obj5}],[{obj1},{obj2},{obj3},{obj4},{obj5}],[{obj1},{obj2},{obj3},{obj4},{obj5}],[{obj1},{obj2},{obj3},{obj4},{obj5}]]

currently stuff array of hashes [{"0"=>[{obj1},{obj2},{obj3},{obj4},{obj5}]},{"1"=>[{obj1},{obj2},{obj3},{obj4},{obj5}] ...]

<tr> <th class="col1" colspan="5"><%= label_tag('feelings') %></th> <th class="col2" colspan="5"><%= label_tag('questions') %></th> <th class="col3" colspan="1"><%= label_tag('events') %></th> </tr> <% @objects[:events].count.times |count| %> <tr>   <% @objects[:events].count.times |times| %>       <td class="col1" colspan="1"><%= @input ? text_field_tag("feelings[]#{count}[][name]", @objects[:feelings][count][times].name) : label_tag('feelings', @objects[:feelings][count][times].name) %></td>   <% end %>   <% @objects[:events].count.times |times| %>       <td class="col2" colspan="1"><%= @input ? text_field_tag("questions[]#{count}[][name]", @objects[:questions][count][times].name) : label_tag('questions', @objects[:questions][count][times].name) %></td>   <% end %>   <td class="col3" colspan="4"><%= @input ? text_field_tag('events[][name]', @objects[:events][count].name) : label_tag('events', @objects[:events][count].name) %></td>   </tr> <% end %> 


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -