ActionView::Base.field_error_proc not getting an error field

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…


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 = do |html_tag, instance|

I just get the html_tag for email and last_name, never for
role_name …

what’s wrong ?

thanks for your lights …