During the update action of a nested form, instead of updating the current nested records, it seems to create new nested records.
This is what my controller looks like
update_only does not work for has_many relationships. You need to add the nested attribute :id field to your strong parameters:
def application_params
params.require(:application).permit(:job_id, :user_id,
answers_attributes:[:id, :question_id, :content]).merge(user_id: current_user.id,
job_id: params[:job_id])
end
Try adding update_only
to your call to accepts_nested_attributes_for
.
accepts_nested_attributes_for :nested_attribute, update_only: true