I have some simple models that inherit from a parent (using STI). In
all but one case, all of the validations are declared in the parent
model like:
class InfoRequest < ActiveRecord::Base
validates_presence_of :full_name,
:email_address,
:phone_number,
:mailing_address
… etc …
end
In one of the child models, I need to add one more validation rule (it
has an extra attribute) like so:
class CreditInfoRequest < InfoRequest
validates_acceptance_of :auth_to_share
end
Except doing this seems to blow away all my validations for this model.
If I don’t declare any validations in the child model, the parent’s
validations are inherited and run just fine. But the minute I add
validations to the child, both it’s and the inherited validations fail
to run.
What?
BTW, I can get around this by overriding the validate method in the
child model but that just bugs me.
Can someone shed some light on this?
-Chris