I'm using Rails Admin on one of my sites. It's great so far, but I can't figure out how to remove a related object from an edit page.
Example: I have two models Property and PropertyImage.
class Property
has_many :property_images, :dependent => :destroy
end
class PropertyImage
belongs_to :property
end
I can go to the edit screen for an instance of either model, and I can delete PropertyImages from their list view. But when I edit a Property, I want to be able to delete a PropertyImage that's associated with it. Is there a way to turn on this functionality in rails_admin?
Here's what I can see.
Note: the "Delete Image" button isn't what I'm looking for - it's just because there's an upload association to the Image field. It only edits the PropertyImage.
I had this same question, and found an answer that works for me after reading your question.
In order to properly setup up the editing of PropertyImage from the Property form, you probably want to specify that it can work with the nested form:
Including the
:allow_destroy
option should make the delete option show up for the nested item.