我想根据类属性的数据类型来验证它们。 我正在用ruby编写一个API,我需要检查特定的参数数据是否属于String、hash、Array等类型。例如:我们有 class ApiValidation attr_accessor :fieldName
end 因此,与:presence => true类似,我想再添加一个
我想在Rails 4中添加一个类似validates_uniqueness_of的validates_uniqueness_of助手方法。我把它和我的zxcvbn_validator.rb放在app/验证器下面,如下所示:end
# This allows us to assign the validato