title: after_create action in model is not updating an attribute of the parent model?
body: <p>I have  <em>Post</em> and <em>Comment</em> model.</p>
  
  <p>I want to achieve the following: Each time a post is created or commented the <code>:content_changed_at</code> attribute of the post should update with <code>created_at</code>:</p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
    attr_accessible :title, :content, :tag_names, :content_changed_at
  
    has_many :comments, :dependent =&gt; :destroy
  
    def init_sort_column
      self.content_changed_at = self.created_at || Time.now
    end
  end
  
  class Comment &lt; ActiveRecord::Base
    attr_accessible :content, :user_id
  
    belongs_to :post, :counter_cache =&gt; true
  
    after_create :update_parent_sort_column
  
    private
  
    def update_parent_sort_column
      if self.post
        self.post.content_changed_at = self.created_at
      end
    end
  end
  </code></pre>
  
  <p><code>content_changed_at</code> is updating when the post is created (with its initial <code>created_at</code> date). But for some reason, the attribute is not updating when a post is commented.</p>
  
  <p>This is how a post comment is created:</p>
  
  <p>comments_controller.rb:</p>
  
  <pre><code>  def create
      @post = Post.find(params[:post_id])
      comment_attr = params[:comment].merge :user_id =&gt; current_user.id
      @comment = @post.comments.create(comment_attr)
      redirect_to post_path(@post)
    end
  </code></pre>
  
  <p>The generated SQL when you create a post: </p>
  
  <pre><code>#&lt;Post id: 64, title: "tttttttttest", content: "hello", user_id: nil, created_at: "2012-03-12 10:07:29", updated_at: "2012-03-12 10:07:29", comments_count: 0, total_votes: 0, content_changed_at: "2012-03-12 10:07:29"&gt;
  </code></pre>
  
  <p>Every is working fine for now: <code>content_changed_at: "2012-03-12 10:07:29</code> </p>
  
  <p>The generated SQL when you create a comment for a post: </p>
  
  <pre><code>(0.2ms)  SAVEPOINT active_record_1
    SQL (1.5ms)  INSERT INTO "comments" ("content", "created_at", "post_id", "total_votes", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)  [["content", "teststsetsetset"], ["created_at", Mon, 12 Mar 2012 10:10:09 UTC +00:00], ["post_id", 64], ["total_votes", 0], ["updated_at", Mon, 12 Mar 2012 10:10:09 UTC +00:00], ["user_id", nil]]
    Post Load (0.4ms)  SELECT "posts".* FROM "posts" WHERE "posts"."id" = 64 LIMIT 1
    SQL (0.4ms)  UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 64
     (0.2ms)  RELEASE SAVEPOINT active_record_1
   =&gt; #&lt;Comment id: 51, content: "teststsetsetset", post_id: 64, user_id: nil, created_at: "2012-03-12 10:10:09", updated_at: "2012-03-12 10:10:09", total_votes: 0&gt; 
  </code></pre>
  
  <p>now if I check the post again:</p>
  
  <pre><code>content_changed_at: "2012-03-12 10:07:29
  </code></pre>
  
  <p>The date is the same.</p>
  
  <p>Any suggestions to fix this?</p>