(2.3.5) removing validations

(sorry for misposting this to rubyonrails-core earlier)

Today I tried to remove (actually overwrite) a validation from a model,
from within a plugin.

This was the original validation:
validates_length_of :login, :maximum => 30

This was the only code I could come up with to replace it:

def self.included(base)
base.class_eval do
@validate_callbacks.delete_if { |callback|
begin
(callback.method.respond_to?(:binding)) &&
(eval(“attrs”, callback.method.binding).first == :login) &&
(callback.options[:maximum] == 30)
rescue NameError
false
end
}

validates_length_of(:login, :maximum => 75)

end

Now in this case I could also have changed the options[:maximum] on the
callback, but either way - is there a cleaner way?

– niklas