Validate presence of noteable_type in note model

This commit is contained in:
Grzegorz Bizon 2016-04-29 12:16:18 +02:00 committed by Robert Speicher
parent e558edd1ce
commit 99ef3a84b5
1 changed files with 1 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class Note < ActiveRecord::Base
# Attachments are deprecated and are handled by Markdown uploader
validates :attachment, file_size: { maximum: :max_attachment_size }
validates :noteable_type, presence: true
validates :noteable_id, presence: true, unless: :for_commit?
validates :commit_id, presence: true, if: :for_commit?
validates :author, presence: true