title: Strong params in rails
body: <p>I removed mass assignment vulnerability of the below line :</p>
  
  <pre><code>friend = Friend.find(params[:id])
  friend.update_attributes(params[:name])
  </code></pre>
  
  <p>by rewriting it as :</p>
  
  <pre><code>friend = Friend.find(params[:id])
  friend.update_attributes(params.permit(:name))
  </code></pre>
  
  <p>But this gave me this error :</p>
  
  <pre><code>ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attributes for Friend: name):
  Unpermitted parameters: id
  </code></pre>
  
  <p>Any idea why I am getting this error?</p>
  
  <p><code>Edit :</code></p>
  
  <p>I added <code>attr_accessible :status_id</code> and <code>params.permit(:id, :name)</code> and the error got removed. But is adding <code>attr_accessible</code> the right way to do it as we write strong params to remove this line, isn't it?</p>