[英]How do I get Ambethia Recaptcha to work with simple_form .error_notification?
[英]How do I get simple_form and bootstrap to work together?
我正在使用simple_form
在Rails应用程序中生成表单。 我想对这些表格使用引导程序。 因此,我已经安装了以下gem,并将它们添加到我的gemfile中:(1) simple_form
,(2) twitter-bootstrap-rails
。 最后,按照我运行的simple_form git页面上的说明, rails generate simple_form:install --bootstrap
。
运行bundle install
后, bundle install
所有内容并运行服务器。 但是,表单仍然无法像使用“ form-control”类那样正确显示。
形成
= simple_form_for @user, html: { multipart: :true, class: "form-horizontal" } do |f|
= f.input :headshot_image, as: :file
= f.input :remote_headshot_image_url, placeholder: "Image Url"
= f.input :first_name, required: true
= f.input :middle_name
= f.input :last_name, required: true
我可以通过两种不同的方法使它“工作”(我认为这两种方法都不对)。 首先,我可以在每个输入中添加, class: "form-control"
,或者可以将其添加到simple_form_for :defaults => { :input_html => { :class => "form-control" } }
。 前者有点违背我所相信的目的,而后者则行得通,但也将类应用于不理想的文件输入。
我错过了设置步骤吗? 还是我做错了什么。 如果我需要提供更多信息或遗漏某些内容,请告诉我。 谢谢!
可能您忘记了将引导程序资产添加到application.css文件simple_form自述文件中的以下行:
您必须确保在应用程序上添加了Bootstrap资产的副本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.