Why doesn’t the “well” class get displayed when the page is rendered?
<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>
The form looks like this when rendered:
<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>
Notice class is just “new_user”. No “well”, why and how do I fix it?
Thanks
UPDATE:
I’ve updated it to:
<%= form_for(resource, :class => "well", :as => resource_name, :url => registration_path(resource_name)) do |f| %>
Rendered 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>
Still not working.
Using Rails 3.2.8
Using HAML in the rest of the app even though these files are ERB. Could that be it?
The underlying problem was the inability to modify the views. It wasn’t just limited to the class which I declared in the form_for correctly.
Correct answer:
Customizing Devise views in Rails
It’s the answer with the higher votes.
I couldn’t modify the views because I ran
It should have been
Notice no mention of User.