title: validating at least one checkbox is selected
body: <p>I'm trying to validate that at least one checkbox in the form has been checked, however it's not currently working. </p>
  
  <p>This is what my controller looks like: </p>
  
  <pre><code>class UserExpertise &lt; ActiveRecord::Base
    belongs_to :user
    validate :atleast_one_is_checked
  
    def atleast_one_is_checked
      errors.add(:base, "Select at least one expertise") unless :gardening || :cooking || :cleaning || :washing_up
    end
  end
  </code></pre>
  
  <p>However, no error shows up when none of them are selected. Incidentally, if instead I were to remove the 'unless' portion of the code, as follows, an error shows all the time, regardless of how many or how few are selected. </p>
  
  <pre><code>  def atleast_one_is_checked
      errors.add(:base, "Select at least one expertise") 
    end
  end
  </code></pre>
  
  <p>I can't get validation that at least one checkbox has been selected though, as the above does not seem to work. Any help would be appreciated! </p>