Scaffold Password Confirmation => no red border

I think, you should check your layouts *.rhtml file. In the header must be the following code: <%= stylesheet_link_tag 'scaffold', :media => 'all' %> (if you use scaffold.css)

If you use your owen .css -file, include following code: .fieldWithErrors { padding: 2px; border: 2px solid red; display: table; } (in to *.css file) Andreas Schneider wrote:

I'm having exactly the same problem

The link to the stylesheet is the layouts *.rhtml file and this:

.fieldWithErrors { padding: 2px; border: 2px solid red; display: table; } is included in the stylesheet

But the borders around the fields with erros won't go red

You see, it work like this: If you use built-in form helpers (e.g. text_field helper), they check if the model instance for which you render that field has errors, and if so, it will wrap the generated field HTML in DIV with some class (fieldWithErrors, but I'm not sure).

Then, the validates_confirmation_of is designed to add validation error for the attribute itself, not it's "_confirmation" brother (e.g. for "password", not for "password_confirmation").

So, when text_field for password_confirmation is produced, it find no errors for that field, so no "red border" is displayed around that field.

The same problems I had long ago, when I designed validation for associated objects. E.g. Product should have a Category associated. I used to write class Product < ActiveRecord::Base   belongs_to :category   validates_presence_of :category end

In the product edit I used to create a select for category_id attribute which didn't outlined this select if there was no category specified. The right solution was to do "validates_presence_of :category_id" (and then, if you wish to, do "validates_associated :category").

Solutions are: 1. Leave everything as it is. Actually, It could be a problem with password field, not with password_confirmation field. 2. Design new validation that will check if attributes are equal and add error to password_confirmation instead of password. 3. Design a custom text_field helper for "password_confirmation", that will check if "password" field has errors and outline itself then.