Rails admin hide belongs_to field in has_many nested form
You can automatically hide the fields using inverse_of like this
class Entity < ActiveRecord::Base
# Associations
has_many :contacts, inverse_of: :entity
accepts_nested_attributes_for :contacts, allow_destroy: true
end
class Contact < ActiveRecord::Base
# Associations
belongs_to :entity, inverse_of: :contacts
end
If you set the :inverse_of option on your relations, RailsAdmin will automatically populate the inverse relationship in the modal creation window. (link next to :belongs_to and :has_many multi-select widgets)
Source: https://github.com/sferik/rails_admin/wiki/Associations-basics
Let me know how it went
For the sake of completness and because i had this problem too and solved it, if you want to you can configure a model when it is used inside a nested form just like you do with edit, update, create and nested
class Contact < ActiveRecord::Base
# Associations
belongs_to :entity
rails_admin do
nested do
configure :entity do
hide
end
end
end
end
Visit the official wiki for more info