From c23052aa08e16be12f4054ac3cb435d4c228f51f Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Thu, 22 Sep 2011 15:41:25 +0000 Subject: [PATCH] Rails3: model: replace deprecated 'after_update' method at Message model git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7456 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/message.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/message.rb b/app/models/message.rb index 3207e01f0..f4131dd97 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -41,6 +41,7 @@ class Message < ActiveRecord::Base validates_length_of :subject, :maximum => 255 after_create :add_author_as_watcher, :update_parent_last_reply + after_update :update_messages_board named_scope :visible, lambda {|*args| { :include => {:board => :project}, :conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } } @@ -61,7 +62,7 @@ class Message < ActiveRecord::Base board.reset_counters! end - def after_update + def update_messages_board if board_id_changed? Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id]) Board.reset_counters!(board_id_was) -- 2.39.5