Remove redundant `with_options` from note validators

This commit is contained in:
Grzegorz Bizon 2016-04-26 11:36:50 +02:00 committed by Robert Speicher
parent bf0b51d252
commit 57b551a19f
1 changed files with 3 additions and 5 deletions

View File

@ -33,13 +33,11 @@ class Note < ActiveRecord::Base
validates :commit_id, presence: true, if: :for_commit? validates :commit_id, presence: true, if: :for_commit?
validates :author, presence: true validates :author, presence: true
with_options unless: :for_commit? do validate unless: :for_commit? do |note|
validate do |note|
unless note.noteable.try(:project) == project unless note.noteable.try(:project) == project
errors.add(:invalid_project, 'Note and noteable project mismatch') errors.add(:invalid_project, 'Note and noteable project mismatch')
end end
end end
end
mount_uploader :attachment, AttachmentUploader mount_uploader :attachment, AttachmentUploader