1

I have the validation below for my model:

validates_format_of :name, :with => /\A[\t\\]+\z/, :message => :'errors.backslash_or_tab'

The regex is checking for tabs and backslashes. The issue is that even if the name does not contain a tab or backslash, it does not pass the validation and I get the error message popping up.

Some example scenarios:

  • testing123 - Fails (Expected to pass)
  • backslash\ - Fails (Expected to fail)
  • thisshouldwork - Fails (Expected to pass)
Daniel Lawton
  • 362
  • 1
  • 7
  • 28

0 Answers0