title: rails has_many minimum collection size update validation
body: <p>I have a <code>has_many</code> association that accepts nested attributes.  I need for there to be a minimum of 1 associated object in the collection, so I wrote a custom validator:</p>
  
  <pre><code>class MinimumCollectionSizeValidator &lt; ActiveModel::EachValidator
    def validate_each(record, attribute, value)
      if value.size &lt; options[:size]
        record.errors[attribute] &lt;&lt; (options[:message] || "must have at least #{options[:size]} line.")
      end
    end
  end
  </code></pre>
  
  <p>The model looks like:</p>
  
  <pre><code>has_many :foos, :dependent=&gt;:destroy
  accepts_nested_attributes_for :foos
  validates :foos, :minimum_collection_size=&gt;{:size=&gt;1}
  </code></pre>
  
  <p>This works great on model creation, but fails miserable on update.  <code>@my_model.update_attributes(params[:my_model])</code> returns true even if all the foos are removed by _destroy.</p>
  
  <p>How do I get <code>update_attributes</code> to behave the same as <code>save</code>?</p>