lib/grape/validations/validators/coerce.rb in grape-1.5.3 vs lib/grape/validations/validators/coerce.rb in grape-1.6.0
- old
+ new
@@ -25,14 +25,10 @@
else
Types.build_coercer(type, method: @option[:method])
end
end
- def validate(request)
- super
- end
-
def validate_param!(attr_name, params)
raise validation_exception(attr_name) unless params.is_a? Hash
new_value = coerce_value(params[attr_name])
@@ -45,10 +41,10 @@
# => #<Hashie::Mash list=#<Hashie::Array [1, 2, 3, 4]>>
# list = h.list
# h[:list] = list
# h
# => #<Hashie::Mash list=[1, 2, 3, 4]>
- return if params[attr_name].class == new_value.class && params[attr_name] == new_value
+ return if params[attr_name].instance_of?(new_value.class) && params[attr_name] == new_value
params[attr_name] = new_value
end
private