gpt4 book ai didi

css - 将 Bootstrap 类应用于 Rails 中的 form_for

转载 作者:行者123 更新时间:2023-11-28 17:34:44 24 4
gpt4 key购买 nike

我正在尝试将 Bootstrap 类“form-horizo​​ntal center”应用到我的 rails form_for 助手,如下所示:

<%= form_for(@customer), :html => {:class => "form-horizontal center"} do |f| %>

我遇到语法错误。

我没有运气地看过这个:How to add a class to the form_for helper in a Rails 4 app?

有什么想法吗?

最佳答案

<%= form_for @customer, :html => {:class => "form-horizontal center"} do |f| %>

@customer 中删除括号或在 do 之前移动右括号:

<%= form_for(@customer, :html => {:class => "form-horizontal center"}) do |f| %>

关于css - 将 Bootstrap 类应用于 Rails 中的 form_for,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25296545/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com