I need a validates_format_of that disallow dots.
In the api there is nothing to find about how validates_format_of exatly works. Is there a better documentation or is there something that can tell me howto disallow dots.
I need a validates_format_of that disallow dots.
In the api there is nothing to find about how validates_format_of exatly works. Is there a better documentation or is there something that can tell me howto disallow dots.
I'm not sure how validates_format_of can be explained better than it is in the API. You give it a field to validate, and you give it a regex that must be matched for the field to be considered valid.
If literally your only requirement is that there are no dots then:
validates_format_of :field, :with => /\A[^.]+\Z/
which validates that field has at least 1 character between the start and end of the string and that that character or characters are not dots, since the regex calls for an unbroken string of "notdots" between start and end. For more detail on how regular expressions work in ruby, you might want to look here:
http://doc.infosnel.nl/ruby_regular_expressions.html
Hope this helps, Jon