[英]Client Side Validations on Heroku
I am using https://github.com/bcardarella/client_side_validations to validate my sign up form. 我正在使用https://github.com/bcardarella/client_side_validations来验证我的注册表单。
I am validating the uniqueness of username and email in that form: 我正在以这种形式验证用户名和电子邮件的唯一性:
validates_uniqueness_of :username, :email, :case_sensitive => false
The database validations for uniqueness are taking place fine on my local machine. 数据库验证的唯一性在我的本地计算机上进行得很好。 But when I try them on Heroku, they do not work. 但是,当我在Heroku上尝试使用它们时,它们将无法工作。
Edit: 编辑:
Here is the sign up form (I am using devise): 这是注册表格(我正在使用devise):
<%= form_for @user, :as => :user, :validate => true, :url => user_registration_path do |f| %>
<div><%= f.label :name, :class => "signupin-label span-2" %><%= f.text_field :name, :class => "signupin-field last", :autocomplete => "off"%></div>
<div><%= f.label :username, :class => "signupin-label span-2" %><%= f.text_field :username, :class => "signupin-field last", :autocomplete => "off" %></div>
<div><%= f.label :email, :class => "signupin-label span-2" %><%= f.text_field :email, :class => "signupin-field last", :autocomplete => "off" %></div>
<div><%= f.label :password, :class => "signupin-label span-2" %><%= f.password_field :password, :class => "signupin-field last", :autocomplete => "off" %></div>
<div class="signupin-bl"><%= f.submit "Sign up", :id => "signUpButton" %></div>
<% end %>
I am getting following error: 我收到以下错误:
rails.validations.js:154 rails.validations.js:154
Uncaught TypeError: Object (?-mix:^(a-zA-Z* ?| ([a-zA-Z0-9]+_?)*)$) has no method 'test' 未捕获的TypeError:对象(?-mix:^(a-zA-Z * ?| ([a-zA-Z0-9] + _?)*)$)没有方法'test'
Can someone please guide? 有人可以指导吗?
Thanks! 谢谢!
I found the issue. 我发现了问题。 I was not validating the format of username on the client side and that was causing this error. 我没有在客户端验证用户名的格式,这导致了此错误。 Thanks for your help. 谢谢你的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.