Given a model
class BaseModel < ActiveRecord::Base
validates_presence_of :parent_id
before_save :frobnicate_widgets
end
and a derived model (the underlying database table has a type
field - this is simple rails STI)
class DerivedModel < BaseModel
end
DerivedModel
will in good OO fashion inherit all the behaviour from BaseModel
, including the validates_presence_of :parent_id
. I would like to turn the validation off for DerivedModel
, and prevent the callback methods from firing, preferably without modifying or otherwise breaking BaseModel
What's the easiest and most robust way to do this?