Sha256: 07faf7cff632a309639187bb0d62bb075da71a1a9d297ffe4cd0c909b8e73f3c

Contents?: true

Size: 311 Bytes

Versions: 2

Compression:

Stored size: 311 Bytes

Contents

module MyForum
  class Post < ActiveRecord::Base
    belongs_to  :topic, :counter_cache => true
    belongs_to  :user, :counter_cache => true

    after_create :update_topic_latest_post

    private

    def update_topic_latest_post
      self.topic.update_attribute(:latest_post_id, self.id)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
my_forum-0.0.1.beta2 app/models/my_forum/post.rb
my_forum-0.0.1.beta1 app/models/my_forum/post.rb