Skip to content

Commit d309d9c

Browse files
author
jamesprior
committed
Do not return early in validation block
1 parent a051258 commit d309d9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/cms/behaviors/attaching.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ def validates_attachment_size(name, options = {})
8787
def validates_attachment_presence(name, options = {})
8888
message = options[:message] || "Must provide at least one #{name}"
8989
validate(options) do |record|
90-
return if record.deleted?
91-
unless record.attachments.any? { |a| a.attachment_name == name.to_s }
92-
record.errors.add(:attachment, message)
90+
if !record.deleted?
91+
unless record.attachments.any? { |a| a.attachment_name == name.to_s }
92+
record.errors.add(:attachment, message)
93+
end
9394
end
9495
end
9596
end

0 commit comments

Comments
 (0)