現在activeadminを使用してネストされたフォームを作成しています。ネストされたリソースの追加ボタンをクリックすると、それぞれのネストされたリソースの入力が表示されます。しかし、リソースの追加ボタンをクリックすることなく、入力をデフォルトで表示したいと思います(つまり、フォームがロードされると入力が表示されます)。 私はActiveAdminのドキュメントに対して自分のコードを再チェックして、さまざまなスタックオーバーフローの投稿をチェックしましたが、進歩はそれほどありませんでした。 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
Nested FormがActiveAdminのフォームを表示しない
すべてのフィードバックやアドバイス:管理者/ project.rbに次のように
Picture of how the form current looks like
私のコードです。より多くの情報が必要な場合はお知らせください。
アドバイスありがとうございます。実際にネストされた属性を保存することに問題はありません。ネストされた入力をデフォルトで表示することができません... – Joshua