verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
def create
- @comment = Comment.new(params[:comment])
+ @comment = Comment.new
+ @comment.safe_attributes = params[:comment]
@comment.author = User.current
if @news.comments << @comment
flash[:notice] = l(:label_comment_added)
# 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