我目前使用activeadmin来创建一个嵌套窗体。我可以点击添加嵌套资源按钮,它将显示各个嵌套资源的输入。不过,我希望默认情况下显示输入,而不必点击添加资源按钮(即在表单加载后应该显示输入)。 我对ActiveAdmin文档重新检查了我的代码,并且检查了各种各样的stackoverflow帖子,但无法取得很大进展。嵌套窗体不显示ActiveAdmin的形式
Picture of how the form current looks like
我的代码的admin/project.rb如下: form title: 'Create a New Project' do |f| f.inputs 'Basic Information' do f.input :category f.input :name f.input :location f.input :size, sortable: :size do |project| "#{project.size}m2" end f.input :published? f.has_many :project_main_image, heading: 'Project main image', allow_destroy: true, new_record: false do |a| a.input :photo, hint: image_tag(a.object.photo.thumb.url, class: 'active-admin-thumbnail') a.input :orientation end f.has_many :project_descriptions, allow_destroy: true do |a| a.input :contents, as: :ckeditor, input_html: { ckeditor: { toolbar: 'Full' } } end f.has_many :project_gallery_images, allow_destroy: true do |a| a.input :photo, hint: image_tag(a.object.photo.thumb.url, class: 'active-admin-thumbnail') a.input :orientation a.input :row_order end f.actions end end
任何意见或建议。如果您需要更多信息,请告诉我。
感谢您的建议。我实际上没有问题得到保存嵌套的属性。只是无法获取嵌套输入默认显示... – Joshua