1

我收到关于唯一性的错误,我正在使用客户端验证gem

ActionController::RoutingError (No route matches [GET] "/uniqueness"):

这是我正在使用的版本

client_side_validations (3.2.5)
client_side_validations-formtastic (2.2.1)
client_side_validations-simple_form (2.0.0)
simple_form (2.1.0, 2.0.4, 2.0.0, 1.5.2)

在 github 上发现了这个问题,它说要使用我已经在使用的 gem 的更新版本。请让我知道如何解决此问题。表单是使用简单表单创建的

4

2 回答 2

3

通过更改 rails.validations.js 解决了这个问题

首先我通过

rails g client_side_validations:copy_assets

上线550

改变了

return "//" + window.location.host + "//" + ClientSideValidations.remote_validators_prefix + "/validators/" + validator;

return "//" + window.location.host + ClientSideValidations.remote_validators_prefix + "/validators/" + validator;

这样做是因为 ajax 请求是这样的

http://localhost:3000//validators/uniqueness?case_sensitive=false&user%5Blogin%5D=john&_=1365516039852

你可以注意到有两个斜线

http://localhost:3000//
于 2013-04-09T14:06:42.990 回答
0

正如https://github.com/bcardarella/client_side_validations/pull/532#issuecomment-17316312中所建议的,我添加了以下行:

ClientSideValidations.remote_validators_prefix = null;
于 2013-07-12T09:28:14.463 回答