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