title: Rails 5: disable checkbox on condition
body: <p><strong>I'm trying to figure out how to make checkbox disabled on condition?</strong> </p>
  
  <p>This is my piece of code from view:</p>
  
  <pre><code>&lt;%= f.collection_check_boxes(:company_ids, @user_companies, :id, :name) do |b| %&gt;
   &lt;div class="col-sm-1"&gt;
     &lt;%= b.check_box %&gt;
   &lt;/div&gt;
     &lt;%= b.label %&gt;&lt;br&gt;&lt;br&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I need to make it disabled if <code>@user = current_user</code></p>
  
  <p>In <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes" rel="nofollow noreferrer">collection_check_boxes docs</a> I don't see how to accomplish this. I assume there is some way, but so far no luck of finding one. My naive thinking was maybe condition can be stated somehow in view. <a href="https://stackoverflow.com/questions/4721365/rails3-check-box-tag-how-to-make-a-conditional-disabled">Answers here</a> show how to do that with check_box_tag.</p>
  
  <p>I'd be happy for any hint how to solve this. Thank you!</p>