class Grape::Validations::ExactlyOneOfValidator
Attributes
params[R]
Public Instance Methods
validate!(params)
click to toggle source
Calls superclass method
# File lib/grape/validations/exactly_one_of.rb, line 7 def validate!(params) super if none_of_restricted_params_is_present raise Grape::Exceptions::Validation, param: "#{all_keys}", message_key: :exactly_one end params end
Private Instance Methods
all_keys()
click to toggle source
# File lib/grape/validations/exactly_one_of.rb, line 21 def all_keys attrs.map(&:to_sym) end
none_of_restricted_params_is_present()
click to toggle source
# File lib/grape/validations/exactly_one_of.rb, line 17 def none_of_restricted_params_is_present keys_in_common.length < 1 end