Remove redundant `with_options` from note validators
This commit is contained in:
parent
bf0b51d252
commit
57b551a19f
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue