summaryrefslogtreecommitdiffstats
path: root/app/models/message.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-01 01:11:39 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-01 01:11:39 +0000
commit049b35edb083be1f10ddb653d8fd0778dbd30b14 (patch)
tree306c69bda265e212bcef14c62b9b56f349fbd1b5 /app/models/message.rb
parent8f362558b6ca8f8ce565d9a766d2065c6c3ae68d (diff)
downloadredmine-049b35edb083be1f10ddb653d8fd0778dbd30b14.tar.gz
redmine-049b35edb083be1f10ddb653d8fd0778dbd30b14.zip
Rails3: model: replace deprecated 'validate_on_create' method at Message model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7555 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/message.rb')
-rw-r--r--app/models/message.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/message.rb b/app/models/message.rb
index 10ee02cde..f0c200172 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -39,6 +39,7 @@ class Message < ActiveRecord::Base
attr_protected :locked, :sticky
validates_presence_of :board, :subject, :content
validates_length_of :subject, :maximum => 255
+ validate :cannot_reply_to_locked_topic, :on => :create
after_create :add_author_as_watcher, :update_parent_last_reply
after_update :update_messages_board
@@ -51,7 +52,7 @@ class Message < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_messages, project)
end
- def validate_on_create
+ def cannot_reply_to_locked_topic
# Can not reply to a locked topic
errors.add_to_base 'Topic is locked' if root.locked? && self != root
end