在Rails中将一个Bootstrap类应用于form_for

时间:2014-08-13 21:34:12

标签: css ruby-on-rails twitter-bootstrap

我试图应用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?

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

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

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

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