Maybe just adding :id
to .permit(:name, :contents_attributes => [:body, :type])
will solve the problem?
The result should look like :contents_attributes => [:body, :type, :id]
.
Also have a look on server stdout - it outputs which attributes are not permitted.