title: How to detect if number of associated objects change?
body: <pre><code>class Post &lt; ActiveRecord::Base
    has_many :comments
  
    after_save :do_something, if: -&gt; (post) { [ something like post.comments.count.changed? ] }
  end
  
  class Comment &lt; ActiveRecord::Base
    belongs_to :post
  end
  </code></pre>
  
  <p>How to execute do_something if number of comments change ?</p>
  
  <p>I want to execute do_something if I detect more than 3 changes by example : 2 comments added, 2 deleted.</p>