I''m not sure exactly what you''re asking for here, but the
standard way to
only perform validations "sometimes" is by using the :if
argument/option.
validates_uniqueness_of :last_name, :if => :last_name_should_be_unique?
For more information, see:
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html
On 2/26/07, Rm Rm
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> If a model has validations defined on it and in certain cases I
don''t
> want some validations to be done then how can I disable the validations
> that I don'' want to be done?
>
> model.valid? will do all the validations but I wan''t only some
> validations to be done and others to be ignored.
>
> Like a form for create may have some fields in model which can be left
> blank, so they should not be validated. But in another form those fields
> are present, and the fields which are not present on that screen will
> cause validation to fail.
>
>
> Thanks.
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---