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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---