【发布时间】:2014-02-23 11:31:14
【问题描述】:
我有一个模型。在那个模型中,我创建了一个数组属性,但我不能在表单中使用该属性。
这是我的问题:
= form_for :my_form_name do |f|
%table
- for i in 1..10 do
%tr
- for j in 1..10 do
%td
= f.text_field :example[i][j]
在这种情况下,我想从盒子中收集数据到名为 example 的属性。
当我运行应用程序时,我得到了这个错误:
undefined method `[]' for nil:NilClass
【问题讨论】:
标签: ruby-on-rails ruby arrays forms multidimensional-array