相关疑难解决方法(0)

如何在 simple_form gem 中使用 Bootstrap 的输入组

环境

  • 红宝石 2.5.1
  • 导轨 5.2.1
  • 简单表格 4.0.1

当前行为

我遵循http://simple-form-b​​ootstrap.plataformatec.com.br/examples/input_group 中的示例

我开始<%= simple_form_for app, wrapper: :input_group do |f| %>并得到Couldn't find wrapper with name input_group,所以我取消注释

config.wrappers :input_group, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
    b.use :html5
    b.use :placeholder
    b.optional :maxlength
    b.optional :minlength
    b.optional :pattern
    b.optional :min_max
    b.optional :readonly
    b.use :label, class: 'form-control-label'
    b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba|
      ba.optional :prepend
      ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
      ba.optional :append
    end …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails simple-form simple-form-for

3
推荐指数
1
解决办法
954
查看次数