在线上:
partial_name = ((not group_data[:partial].nil?) && group_data[:partial]) || "basic_form_render";
我不断收到错误“无法将符号转换为整数”。我想这是因为我一次传递了三个 group_name 和 group_data 实例,所以我在 .times 中添加了一个变量来跟踪每个交互(0,1,2),比如
partial_name = ((not group_data[times_iterator][:partial].nil?) && group_data[times_iterator][:partial]) || "basic_form_render";
其中 times 迭代器被初始化为 0 并在每次通过 3.times 循环时递增。但是,我仍然遇到同样的错误。
-form_data.each_with_index do |(category_name, cat_data), i|
-cat_data.each_slice(3).with_index do |(group_name, group_data), j|
- counter+=1
%div{:id => "page#{(counter)}", "data-role" => "page"}
%h3{:style => "text-align:center;"}
=category_name
%hr{:color => "black", :size => "2"}/
-3.times do
-partial_name = ((not group_data[:partial].nil?) && group_data[:partial]) || "basic_form_render";
= render partial_name, :cat_no => (i+1), :group_no => (j+times_iterator), :group_name => group_name, :group_data => group_data
=render "shared/form_footer"