Rails3: replace deprecated 'after_create' method at Message model.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6936 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-01 00:43:03 +00:00
parent 51e2d89608
commit 52dd8b56c9
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class Message < ActiveRecord::Base
validates_presence_of :board, :subject, :content
validates_length_of :subject, :maximum => 255
after_create :add_author_as_watcher
after_create :add_author_as_watcher, :update_parent_last_reply
named_scope :visible, lambda {|*args| { :include => {:board => :project},
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
@ -54,7 +54,7 @@ class Message < ActiveRecord::Base
errors.add_to_base 'Topic is locked' if root.locked? && self != root
end
def after_create
def update_parent_last_reply
if parent
parent.reload.update_attribute(:last_reply_id, self.id)
end