summaryrefslogtreecommitdiffstats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-06 18:48:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-06 18:48:47 +0000
commitbdf6e90f055ae09b7129e73ec062e3e020f01467 (patch)
treebd5f68a6218c848bec72c92699399e72bd713dd1 /app/models/comment.rb
parent6aad82e524c1b2cc8afc3299e129b239f834105b (diff)
downloadredmine-bdf6e90f055ae09b7129e73ec062e3e020f01467.tar.gz
redmine-bdf6e90f055ae09b7129e73ec062e3e020f01467.zip
Prevent mass-assignment when adding a news comment (#10390).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9129 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/comment.rb')
-rw-r--r--app/models/comment.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 701f0344e..4b7e098f1 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -16,8 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Comment < ActiveRecord::Base
+ include Redmine::SafeAttributes
belongs_to :commented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comments
+
+ safe_attributes 'comments'
end