ClientSideValidations.formBuilders[settings.type] is undefin



我正在尝试使用client_side_validationsgem,但遇到了一些问题。首先,我在我的Gemfile

 gem 'client_side_validations', :git => 'https://github.com/bcardarella/client_side_validations.git'

我在捆绑安装后看到

使用来自的client_side_validations(3.2.0.beta.2)https://github.com/bcardarella/client_side_validations.git(在主机上)

但我在宝石列表中没有看到这颗宝石。。。。这是第一个问题。第二,也是更重要的一点,验证不起作用。我在firebug控制台中有一个错误

ClientSideValidations.formBuilders[settings.type] is undefined

并且没有进行验证。我使用的是rails 3.2.1,formtastic 2.0.2,这是我的client_side_validations.rb文件

  # ClientSideValidations Initializer
      # Uncomment the following block if you want each input field to have the validation messages attached.
         # ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
    #   unless html_tag =~ /^<label/
            #     %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
         #   else
        #     %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
       #   end
        # end

任何帮助都会通知。。。。。

问题是,由于Formtastic 2.0版本适用于正确工作的client_side_validations gem,您需要安装client_side_validations-Formtastic gem。

最新更新