Remove "Add new" button from ActiveAdmin has_many form helper
Asked Answered
I

1

7

I have nested resources in active admin edit page, but I would like only to allow admin to edit content of existing resources, not to add new nested resources. My code looks like that:

  form do |f|
    f.inputs do
      f.input :author
      f.input :content
      f.has_many :comments do |comment_form|
        comment_form.input :content
        comment_form.input :_destroy, as: :boolean, required: false, label: 'Remove'
      end
    end
    f.actions
  end

But it add's "Add new comment" button under inputs. How can I disable it, and leave only f.actions buttons for main form?

Interphone answered 17/10, 2013 at 13:17 Comment(1)
i am facing the same problem... Have you solved it?Battleship
G
16

Starting from v0.6.1 you can pass new_record: false to hide the "Add new" button

f.has_many :comments, new_record: false do |comment_form|
...
end

The commit 4b58b8

Gradation answered 8/12, 2013 at 20:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.