客户端验证不适用于唯一性方法

时间:2013-11-21 06:13:16

标签: ruby-on-rails devise mongoid client-side-validation

对于Client_side_validation gem,

validates_uniqueness_of无效。我正在使用MongoID和设计

这是我的代码

/user.rb

  validates_presence_of :name, :email
  validates_uniqueness_of :name ,:email

/形式

%h2 Sign up
= form_for(resource, :as => resource_name,
       :url => registration_path(resource_name),
       :html => {:id => "sign_up_user"},
       :validate => true ,
       :remote => true) do |f|

  %div
    =f.label :name
    %br
    =f.text_field :name, :autofocus => true
  %div
    = f.label :email
    %br/
    = f.email_field :email
  %div
    = f.label :password
    %br/
    = f.password_field :password
  %div
    = f.label :password_confirmation
    %br/
    = f.password_field :password_confirmation
  %div= f.submit "Sign up", class: 'btn btn-success btn-medium'

UPDATE *这是来自浏览器控制台的错误响应

请求网址:http:.... / validators / uniqueness?case_sensitive = false& user%5Bname%5D = jesus& _ = 1385056603510 请求方法:GET 状态代码:500内部服务器错误

0 个答案:

没有答案