thank you. did that and it works.
now, i have the second challenge: the main form gets saved via ajax, and within the controller i check whether ist a create or update flow - BUT, the has_many records (tasks)always get created, instead of updating the existing ones.
here my controller code: >> how can i get the has_mnay records to get updated instead of newly added / created?
if params[:record][:id].blank?
p "NEW mode....#{m}"
@new_rec = m.constantize.new(params[:record].except(:company_id,:company))
@new_rec.company_id = @cid if @new_rec.respond_to?("company_id")
@new_rec.created_by = current_user.id if @new_rec.respond_to?("created_by")
@new_rec.user_id = current_user.id if @new_rec.respond_to?("user_id")
else
p "update mode...."
@is_update = true
@new_rec = m.constantize.find(params[:record][:id])
p @new_rec
@new_rec.assign_attributes(params[:record].except(:id,:company_id,:company))
@new_rec.updated_by = current_user.id if @new_rec.respond_to?("updated_by")
p @new_rec
end