Rails3: replace deprecated 'after_create' method at Message model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6936 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
51e2d89608
commit
52dd8b56c9
|
@ -40,7 +40,7 @@ class Message < ActiveRecord::Base
|
||||||
validates_presence_of :board, :subject, :content
|
validates_presence_of :board, :subject, :content
|
||||||
validates_length_of :subject, :maximum => 255
|
validates_length_of :subject, :maximum => 255
|
||||||
|
|
||||||
after_create :add_author_as_watcher
|
after_create :add_author_as_watcher, :update_parent_last_reply
|
||||||
|
|
||||||
named_scope :visible, lambda {|*args| { :include => {:board => :project},
|
named_scope :visible, lambda {|*args| { :include => {:board => :project},
|
||||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
|
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
|
||||||
|
@ -54,7 +54,7 @@ class Message < ActiveRecord::Base
|
||||||
errors.add_to_base 'Topic is locked' if root.locked? && self != root
|
errors.add_to_base 'Topic is locked' if root.locked? && self != root
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_create
|
def update_parent_last_reply
|
||||||
if parent
|
if parent
|
||||||
parent.reload.update_attribute(:last_reply_id, self.id)
|
parent.reload.update_attribute(:last_reply_id, self.id)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue