Cancel validation in subclass


#1

Quick question,

I have a class which has a validates* declaration to validate the model.
Specifically it has a validates_presence_of declaration. In a subclass
of that class I want to get rid of this validation. Is there a way a
validation can be removed?

Eric


#2

On 27/11/2005, at 4:41 PM, Eric A. wrote:

I have a class which has a validates* declaration to validate the
model. Specifically it has a validates_presence_of declaration. In
a subclass of that class I want to get rid of this validation. Is
there a way a validation can be removed?

class Upper < ActiveRecord::Base

 validates_presence_of :imported_beer, :if => :upper_class

 protected

 def upper_class(yuppie)
     yuppie.class == Upper
 end

end

– tim