title: Rails Controller Params - Custom Update Method for CanCan work around
body: <p>I'm trying to limit access to a certain attribute when updating.</p>
  
  <p>An admin is allowed to update all of a <code>Need</code> anytime they want, <em>except</em> they can only update the <code>Need</code>'s <code>is_public</code> bool only if <code>need_state</code> is <code>in_progress</code>.</p>
  
  <p>CanCan doesn't allow a way to limit the update action based on specific attributes that are being set... so I thought they only way to accomplish this was to make a special method called <code>set_is_public</code>.</p>
  
  <p>I've got my form calling to it and it's sending the following params:</p>
  
  <pre><code>{"utf8"=&gt;"✓",
   "authenticity_token"=&gt;"2u9AZ7AJDYQrXm3LubMAxlxhjbsQ14myUTyOSyvoKzk=",
   "need"=&gt;{"id"=&gt;"5",
   "is_public"=&gt;"true"},
   "commit"=&gt;"Set as Public"}
  </code></pre>
  
  <p>How do you go about updating that need in the action in the controller?<br>
  I can't figure out how to read those params in and:</p>
  
  <ul>
  <li>Find the need based on the id;</li>
  <li>Update its <code>is_public</code> attribute to the value of the <code>is_public</code> param.</li>
  </ul>