diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 15:41:25 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 15:41:25 +0000 |
commit | c23052aa08e16be12f4054ac3cb435d4c228f51f (patch) | |
tree | 15897a86dcedd2f4e7c11f4fde87c45fea2baa60 /app/models/message.rb | |
parent | f5df7434464bb7942deb95bb79b7394d1cb45fda (diff) | |
download | redmine-c23052aa08e16be12f4054ac3cb435d4c228f51f.tar.gz redmine-c23052aa08e16be12f4054ac3cb435d4c228f51f.zip |
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
Diffstat (limited to 'app/models/message.rb')
-rw-r--r-- | app/models/message.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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) |