[Rails] Overriding validation?

Bill Walton
Tue, 23 May 2006 14:03:59 -0000

Hi Steven,

Steven Rogers writes:
>
> Is there a "normal" way to override the behavior of validator
methods
> (like validates_presence_of) for updates vs. creation?

The approach Calle recommended puts control of the validation within the
model which is where it typically belongs and which, it sounds like, is
appropriate to your situation.  I recently had what I''d consider a
fairsituation where I needed to create an empty record (i.e., without doing
any validation) and had difficulty getting the :on => :update
there''s the
additional option of using Object.save_with_validations(false)