DEPRECATION FIX: use after_update :method_name instead of overwriting the after_update method

pull/1186/head
Martin Linkhorst 12 years ago
parent bb4ff05d15
commit 13ff784e00
  1. 3
      app/models/message.rb

@ -47,6 +47,7 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher after_create :add_author_as_watcher
after_create :update_last_reply_in_parent after_create :update_last_reply_in_parent
after_update :update_ancestors
after_destroy :reset_counters after_destroy :reset_counters
scope :visible, lambda {|*args| { :include => {:board => :project}, scope :visible, lambda {|*args| { :include => {:board => :project},
@ -76,7 +77,7 @@ class Message < ActiveRecord::Base
board.reset_counters! board.reset_counters!
end end
def after_update def update_ancestors
if board_id_changed? if board_id_changed?
Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id]) Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id])
Board.reset_counters!(board_id_was) Board.reset_counters!(board_id_was)

Loading…
Cancel
Save