Fixed required_field_validator to behave correctly with boolean fields
This commit is contained in:
parent
16d9e819d7
commit
e27135cb1e
|
@ -37,7 +37,7 @@ module CouchRest
|
|||
|
||||
def call(target)
|
||||
value = target.validation_property_value(field_name)
|
||||
property = target.validation_property(field_name)
|
||||
property = target.validation_property(field_name.to_s)
|
||||
return true if present?(value, property)
|
||||
|
||||
error_message = @options[:message] || default_error(property)
|
||||
|
@ -66,7 +66,7 @@ module CouchRest
|
|||
# Returns false for other property types.
|
||||
# Returns false for non-properties.
|
||||
def boolean_type?(property)
|
||||
property ? property.type == TrueClass : false
|
||||
property ? property.type == 'Boolean' : false
|
||||
end
|
||||
|
||||
end # class RequiredFieldValidator
|
||||
|
|
Loading…
Reference in a new issue