check_validity!() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/validations/format.rb, line 14
      def check_validity!
        unless options.include?(:with) ^ options.include?(:without)  # ^ == xor, or "exclusive or"
          raise ArgumentError, "Either :with or :without must be supplied (but not both)"
        end

        if options[:with] && !options[:with].is_a?(Regexp)
          raise ArgumentError, "A regular expression must be supplied as the :with option of the configuration hash"
        end

        if options[:without] && !options[:without].is_a?(Regexp)
          raise ArgumentError, "A regular expression must be supplied as the :without option of the configuration hash"
        end
      end
Register or log in to add new notes.