在使用bootstrap_form gem与ruby-on-rails结合时,如何解决找不到文件‘rails_bootstrap_form’的问题?

更新于
2026-10-03 21:44:30
2阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计275个文字,预计阅读时间需要2分钟。

我正在尝试使用bootstrap_form 2.0.1宝石(见https://github.com/bootstrap-ruby/rails-bootstrap-forms)。但它的安装并不适合我。我根据GitHub页面上的说明安装,将其添加到我的Gemfile中:gem 'bootstrap_form', '~> 2.0.1'。

我正在尝试使用bootstrap_form~> 2.0.1宝石(见 github.com/bootstrap-ruby/rails-bootstrap-forms),但它给了我适合.我按照github页面上的说明安装,将其添加到我的Gemfile中:

gem 'bootstrap_form', '~> 2.0.1'

我运行了bundle install.然后我将它添加到我的application.css.scss文件中:

*= require_self *= require rails_bootstrap_forms *= require_tree .

但是,当我尝试运行我的应用程序时,我得到:

couldn’t find file ‘rails_bootstrap_forms’ (in /path/to/my/app/assets/stylesheets/application.css.scss:12)

我显然错过了一些东西.我检查了lib / assets /和vendor / assets / stylesheets /但是那里什么都没有.同样,app / assets / stylesheets /中没有任何内容.

什么是软糖?

您必须在app / assets / stylesheets中创建文件rails_bootstrap_form.css

.rails-bootstrap-forms-date-select, .rails-bootstrap-forms-time-select, .rails-bootstrap-forms-datetime-select { select { display: inline-block; width: auto; } } .rails-bootstrap-forms-error-summary { margin-top: 10px; }

本文共计275个文字,预计阅读时间需要2分钟。

我正在尝试使用bootstrap_form 2.0.1宝石(见https://github.com/bootstrap-ruby/rails-bootstrap-forms)。但它的安装并不适合我。我根据GitHub页面上的说明安装,将其添加到我的Gemfile中:gem 'bootstrap_form', '~> 2.0.1'。

我正在尝试使用bootstrap_form~> 2.0.1宝石(见 github.com/bootstrap-ruby/rails-bootstrap-forms),但它给了我适合.我按照github页面上的说明安装,将其添加到我的Gemfile中:

gem 'bootstrap_form', '~> 2.0.1'

我运行了bundle install.然后我将它添加到我的application.css.scss文件中:

*= require_self *= require rails_bootstrap_forms *= require_tree .

但是,当我尝试运行我的应用程序时,我得到:

couldn’t find file ‘rails_bootstrap_forms’ (in /path/to/my/app/assets/stylesheets/application.css.scss:12)

我显然错过了一些东西.我检查了lib / assets /和vendor / assets / stylesheets /但是那里什么都没有.同样,app / assets / stylesheets /中没有任何内容.

什么是软糖?

您必须在app / assets / stylesheets中创建文件rails_bootstrap_form.css

.rails-bootstrap-forms-date-select, .rails-bootstrap-forms-time-select, .rails-bootstrap-forms-datetime-select { select { display: inline-block; width: auto; } } .rails-bootstrap-forms-error-summary { margin-top: 10px; }