@@ -40,7 +40,7 class Message < ActiveRecord::Base | |||
|
40 | 40 | validates_presence_of :board, :subject, :content |
|
41 | 41 | validates_length_of :subject, :maximum => 255 |
|
42 | 42 | |
|
43 | after_create :add_author_as_watcher | |
|
43 | after_create :add_author_as_watcher, :update_parent_last_reply | |
|
44 | 44 | |
|
45 | 45 | named_scope :visible, lambda {|*args| { :include => {:board => :project}, |
|
46 | 46 | :conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } } |
@@ -54,7 +54,7 class Message < ActiveRecord::Base | |||
|
54 | 54 | errors.add_to_base 'Topic is locked' if root.locked? && self != root |
|
55 | 55 | end |
|
56 | 56 | |
|
57 | def after_create | |
|
57 | def update_parent_last_reply | |
|
58 | 58 | if parent |
|
59 | 59 | parent.reload.update_attribute(:last_reply_id, self.id) |
|
60 | 60 | end |
General Comments 0
You need to be logged in to leave comments.
Login now