一直试图弄清楚为什么我的窗体无法正常工作。 - 这是 最接近我得到它的工作,它显示位置字段 当我这样做,但是当我提交表格时说“未知属性 位置”,我相信是因为位置实际上应该是 访问像f.inputs:name =>“Location”,:for =>:location do | location_form |,而不是我下面的(右),但是当我做它 非复数什么都没有显示出来。如果我做它复数,它doesen't 知道如何处理位置属性。任何人都可以告诉我,如果我 我做错了什么,或者如果这是一个错误?非常感谢 提前。rails ActiveAdmin嵌套窗体formtastic问题
class Store < ActiveRecord::Base
has_one :location
belongs_to :admin_user
accepts_nested_attributes_for :location
end
class Location < ActiveRecord::Base
belongs_to :store
end
ActiveAdmin.register Store do
form do |f|
f.inputs "Details" do
f.input :name
f.input :description
f.input :admin_user
end
f.inputs :name => "Location", :for => :locations do |location_form|
location_form.input :address
end
f.buttons
end
end
不起作用,即使它确实,位置是一个has_one关系,所以我认为它不适用 – thrice801