title: How to merge nested attributes in permit + Rails
body: <pre><code>params.require(:task).permit(:summary, comments_attributes: [:id, :content])
  </code></pre>
  
  <p>I want to add <strong>user_id</strong> and <strong>project_id</strong> in comments_attributes.</p>
  
  <pre><code>user_id    = current_user.id
  project_id = project.id
  </code></pre>
  
  <p>I tried with below but not working</p>
  
  <pre><code>params.require(:task).permit(:summary, comments_attributes: [:id, :content]).merge(user_id: current_user.id, comments_attributes: [user_id: current_user.id, project_id: project.id])
  </code></pre>
  
  <p>Please help me how can I do this?</p>