我正在尝试为与 Step 具有 has_many 关系的 Recipe 模型自定义 ActiveAdmin 表单。
class Recipe < ActiveRecord::Base
has_many :steps
end
class Step < ActiveRecord::Base
acts_as_list :scope => :recipe
belongs_to :recipe
end
我的 ActiveAdmin 文件中有以下与此相关的内容:
form do |f|
f.has_many :steps do |ing_f|
ing_f.inputs
end
end
当我尝试加载表单时引发以下错误:
未定义的方法`new_record?对于零:NilClass
到目前为止,我已经将它与 has_many 方法隔离开来,但我已经迷失了这一点。任何建议和帮助将不胜感激!