title: check_box_tag validate for form_tag
body: <p>I have a problem with validating either at least one of the checkboxes was clicked before user can continue. My View looks likes this:</p>
  
  <p>View:</p>
  
  <pre><code>&lt;%= form_tag("/categories/", :method =&gt; "post") do%&gt;
  &lt;% @categories.each do |category| %&gt;
      &lt;div class="checkbox"&gt;
      &lt;li&gt;&lt;%= check_box_tag "categories[]", category.id %&gt; &lt;%= category.name %&gt;&lt;/li&gt;
  
      &lt;/div&gt;      
  
  &lt;%end%&gt;
  &lt;%= submit_tag "Weiter", class: "btn btn-success btn-lg" %&gt;
  </code></pre>
  
  
  
  <pre><code>class Category &lt; ActiveRecord::Base
  has_and_belongs_to_many :users
  has_and_belongs_to_many :books
  end
  </code></pre>
  
  <p>So what happens is that user registeres and gets the screen with all categories which are available in the category model. He then checks those and clicks proceed. On Post categories got associated with users. But how can I validate that the user chooses at least 1 category. If I do something like this it doesn't work:</p>
  
  <pre><code>validates_acceptance_of :categories,
  :message =&gt; "Please take at least one category", :accept =&gt; true
  </code></pre>