# ActionView::Base.field\_error\_proc not getting an error field

**URL:** <https://www.ruby-forum.com/t/actionview-base-field-error-proc-not-getting-an-error-field/142298>\
**Category:** Rails\
**Created:** [July 6, 2008, 12:45pm UTC](https://www.ruby-forum.com/t/actionview-base-field-error-proc-not-getting-an-error-field/142298 "2008-07-06T12:45:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [July 6, 2008, 12:45pm UTC](https://www.ruby-forum.com/t/actionview-base-field-error-proc-not-getting-an-error-field/142298/1 "2008-07-06T12:45:28Z")

</div>

In my User form I have standard field to get user record attributes  
(first\_name, last\_name and email)  
I also have a select drop\_down to choose a role from an array  
first\_name, last\_name and email are user record attributes, but I  
defined the role name as a virtual attribute

validates\_presence\_of :email, :last\_name

attr\_accessor :role\_name  
validates\_presence\_of :role\_name, :if  
=\> :role\_name\_required?, :message =\> ‘must be selected’

when testing with a blank form, I get all errors detected during User  
model validation, which is fine…

BUT

ActionView::Base.field\_error\_proc doesn’t get the role\_name error, so  
I cannot change the style of the select

I checked it , debugging the proc :

ActionView::Base.field\_error\_proc = Proc.new do |html\_tag, instance|  
debugger  
…

I just get the html\_tag for email and last\_name, never for  
role\_name …

what’s wrong ?

thanks for your lights …
