]> source.dussan.org Git - redmine.git/commitdiff
Rails3: model: replace deprecated 'after_update' method at Message model
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Sep 2011 15:41:25 +0000 (15:41 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Sep 2011 15:41:25 +0000 (15:41 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7456 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/message.rb

index 3207e01f0c2672b7708b08ad647cd7a09fdf6752..f4131dd975d07c81a25da55f38f508dd5810c068 100644 (file)
@@ -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)