##// END OF EJS Templates
Rails3: model: replace deprecated 'after_update' method at Message model...
Toshi MARUYAMA -
r7336:c23052aa08e1
parent child
Show More
@@ -41,6 +41,7 class Message < ActiveRecord::Base
41 41 validates_length_of :subject, :maximum => 255
42 42
43 43 after_create :add_author_as_watcher, :update_parent_last_reply
44 after_update :update_messages_board
44 45
45 46 named_scope :visible, lambda {|*args| { :include => {:board => :project},
46 47 :conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
@@ -61,7 +62,7 class Message < ActiveRecord::Base
61 62 board.reset_counters!
62 63 end
63 64
64 def after_update
65 def update_messages_board
65 66 if board_id_changed?
66 67 Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id])
67 68 Board.reset_counters!(board_id_was)
General Comments 0
You need to be logged in to leave comments. Login now