Only allow creation of has_many in ActiveAdmin

I have a has_many relation for which I have disabled destroying:

unless f.object.new_record?
  f.inputs do
    f.has_many :foos, allow_destroy: false do |foo|
      foo.input :bar

Currently once I’ve saved the main object and go back and edit, I can edit previously created foos. I’d like this to not be the case and only have the ability to add new ones. How can I achieve this?

I can see ActiveAdmin provides allow_destroy and new_record, but there isn’t something analogous to allow_edit.

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.