为什么渲染页面时不显示“well”类?
<div class="container">
<div class="row">
<div class="offset4 span4">
<h2>Sign up</h2>
<%= form_for(resource, :html => { :class => "well" }, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render "devise/shared/links" %>
</div>
</div>
</div>
呈现时表单如下所示:
<form method="post" id="new_user" class="new_user" action="/users" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="P3KHtU5CRNy0/kVEvck4coilSOWCHYaKPZ5D1xCxQj4=" name="authenticity_token"></div>
<div><label for="user_email">Email</label><br>
<input type="email" value="" size="30" name="user[email]" id="user_email"></div>
<div><label for="user_password">Password</label><br>
<input type="password" size="30" name="user[password]" id="user_password"></div>
<div><label for="user_password_confirmation">Password confirmation</label><br>
<input type="password" size="30" name="user[password_confirmation]" id="user_password_confirmation"></div>
<div><input type="submit" value="Sign up" name="commit"></div>
</form>
通知类只是“new_user”。没有“好”,为什么以及如何解决它?
谢谢
更新:
我已将其更新为:
<%= form_for(resource, :class => "well", :as => resource_name, :url => registration_path(resource_name)) do |f| %>
呈现的 HTML:
<form method="post" id="new_user" class="new_user" action="/users" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="P3KHtU5CRNy0/kVEvck4coilSOWCHYaKPZ5D1xCxQj4=" name="authenticity_token"></div>
还是行不通。使用 Rails 3.2.8 在应用程序的其余部分使用 HAML,即使这些文件是 ERB。会是这样吗?