我想从新模板中获取以嵌套数组格式创建动作的参数。 例如。我正在尝试建立一种excel类型的形式。 所以我有3个主要标题感受,问题,事件 感觉和事件每个有5列,事件有1列 我将所有事件数据都包含在5个哈希元素的数组中 我希望将感知和问题数据作为5个哈希元素的嵌套数组 所以Event = [{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}],[{OBJ1},{OBJ2},{OBJ3 },{OBJ4},{obj5}]]
目前将这些东西作为哈希数组得到 [{ “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 do |count| %>
<tr>
<% @objects[:events].count.times do |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 do |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 %>