Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在RubyonRails中将div中的所有数据绑定为子集_Ruby On Rails_Ruby_Ruby On Rails 5 - Fatal编程技术网

Ruby on rails 如何在RubyonRails中将div中的所有数据绑定为子集

Ruby on rails 如何在RubyonRails中将div中的所有数据绑定为子集,ruby-on-rails,ruby,ruby-on-rails-5,Ruby On Rails,Ruby,Ruby On Rails 5,在这里,我试图将表单中输入的所有数据保存到数据库中 目前,我的HTML部分表单如下: <% LookupValue.laststatus.each do |d| %> <div class="row row-margin" id="Counter"> <div class="col-md-4"> <%= f.label :"#{d.LookupValueName}:", :class => "col-form-label f

在这里,我试图将表单中输入的所有数据保存到数据库中

目前,我的HTML部分表单如下:

<% LookupValue.laststatus.each do |d| %>
  <div class="row row-margin" id="Counter">
    <div class="col-md-4">
      <%= f.label :"#{d.LookupValueName}:", :class => "col-form-label float-md-right", :for=>"Metric:"+d.LookupValueName%>
    </div>
    <div class="col-md-4">
      <%= f.text_field :"Counter", :class => "form-control tala-count",:id =>"Counter"+d.LookupValueId.to_s, placeholder: "tala Count" %>
    </div>
    <div class="col-md-4">
      <%= f.text_field :"Gantalu", :class => "form-control Gantalu",:id =>"Gantalu"+d.LookupValueId.to_s, placeholder: "Gantalu" %>
    </div>
  </div>
<%end%>

<div class="row row-margin other-metric-row">
  <% if last_LookupValue = LookupValue.status.last %>
    <div class="col-md-4">
      <%= f.text_field :"Gantalu", :class => "form-control other-metric",:id =>last_LookupValue.LookupValueId, placeholder: "Other" %>
    </div>
    <div class="col-md-4">
      <%= f.text_field :"Counter", :class => "form-control tala-count",:id =>"Counter"+last_LookupValue.LookupValueId.to_s, placeholder: "tala Count" %>
    </div>
    <div class="col-md-4">
      <%= f.text_field :"Gantalu", :class => "form-control Gantalu",:id =>"Counter"+last_LookupValue.LookupValueId.to_s, placeholder: "Gantalu" %>
    </div>
  <%end%>
</div>
final[Counter]: Value1
final[Gantalu]: 1
final[Counter]: Value2
final[Gantalu]: 11
final[Counter]: Value3
final[Gantalu]: 111
final[Counter]: Value4
final[Gantalu]: 1111
final[Gantalu]: 
final[Counter]: 
final[Gantalu]:
不知道如何获取单个变量下的所有计数器数据,以便访问每个文本框中输入的所有数据并访问它们


提前感谢

您认为如何在一个变量中获得多个字段?您希望它是数组吗?引用为变量可能是错误的。但是,我的意图是将所有输入的文本包装在相应的字段中,作为“Counter”的对象。每个文本框都有唯一的ID。我希望计数器节点的数据如下所示,包含许多子值:{'person'=>{'name'=>'John Doe','counter'=>{'ID'=>'Home','tala'=>'Home','gantalu'=>'221b Baker Street'},{'id'=>'Home','tala'=>'Home','gantalu'=>'221b Baker Street'}}}}}顺便说一句,你可能想看看:你的命名有点不传统。可以用@jvillian。同时,你能帮我解决我的问题吗。