I have been reading and researching for about 3 days now. This is my last resort.
land.rb:
has_many :uploads , :dependent => :destroy
accepts_nest
You need to allow the :_destroy
parameter for your nested model as well, as this gets used when you check the 'Delete' checkbox in the form. It's Rails' way of flagging model instances that have to be destroyed.
def land_params
params.require(:land).permit(uploads_attributes: [:id, :filename, :_destroy])
end
The OP didn't have the same problem as me, but for anyone coming across this question, for me, it was the absence of allow_destroy: true
as an argument on the accepts_nested_attributes
call in the model.