Skip to content

Commit e20cb95

Browse files
committed
Revert change to Optionsvalidator (null check)
1 parent af076fe commit e20cb95

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/messages/validators.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,11 @@ def validate(record)
242242

243243
class OptionsValidator < ActiveModel::Validator
244244
def validate(record)
245-
if record.options.blank?
246-
# Route Creation with explicit 'null' options is not allowed
247-
record.errors.add(:options, message: 'is not a valid object') if record.is_a?(VCAP::CloudController::RouteCreateMessage) && record.options.nil?
248-
return
249-
end
245+
# Empty option hashes are allowed, so we skip further validation
246+
record.options.blank? && return
250247

251248
unless record.options.is_a?(Hash)
252-
record.errors.add(:options, message: 'is not a valid object')
249+
record.errors.add(:options, message: "'options' is not a valid object")
253250
return
254251
end
255252

0 commit comments

Comments
 (0)