当前位置 : 主页 > 编程语言 > ruby >

ruby-on-rails – Rails 5中的客户端验证simple_form

来源:互联网 收集:自由互联 发布时间:2021-06-23
当我把以下内容放在我的gemfile中时: gem 'simple_form'gem 'client_side_validations'#, github: 'DavyJonesLocker/client_side_validations'gem 'client_side_validations-simple_form'#, github: 'DavyJonesLocker/client_side_validations
当我把以下内容放在我的gemfile中时:

gem 'simple_form'
gem 'client_side_validations'#, github: 'DavyJonesLocker/client_side_validations'
gem 'client_side_validations-simple_form'#, github: 'DavyJonesLocker/client_side_validations-simple_form'

结果如下:

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    rails (= 5.0.0)

    client_side_validations-simple_form was resolved to 3.2.0, which depends on
      client_side_validations (~> 4.2.0) was resolved to 4.2.0, which depends on
        rails (< 4.3.0, >= 4.0.0)

让这些宝石发挥作用的任何想法?

您可以通过指定分支来使用带有Rails 5的client_side_validations:

gem 'client_side_validations', 
    github: 'DavyJonesLocker/client_side_validations', 
    branch: 'rails5'

如果使用简单形式:

gem 'client_side_validations-simple_form', 
    github: 'DavyJonesLocker/client_side_validations-simple_form', 
    branch: 'rails5'
网友评论