From 57b551a19f18d8da78175b4de6098d5517cde49f Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 26 Apr 2016 11:36:50 +0200 Subject: [PATCH] Remove redundant `with_options` from note validators --- app/models/note.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/models/note.rb b/app/models/note.rb index 02a98a37117..f10446ca45f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -33,11 +33,9 @@ class Note < ActiveRecord::Base validates :commit_id, presence: true, if: :for_commit? validates :author, presence: true - with_options unless: :for_commit? do - validate do |note| - unless note.noteable.try(:project) == project - errors.add(:invalid_project, 'Note and noteable project mismatch') - end + validate unless: :for_commit? do |note| + unless note.noteable.try(:project) == project + errors.add(:invalid_project, 'Note and noteable project mismatch') end end