- :format => { :with => %r{\A[^\x00-\x1f\x7f\ufffe\uffff]*\z} }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => %r{\A[^#{INVALID_CHARS}]*\z},
- :message => "cannot contain invalid chars: #{INVALID_CHARS}", invalid_chars: INVALID_CHARS }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\A\S/, :message => "has leading whitespace" }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\S\z/, :message => "has trailing whitespace" }
- validates :email, :presence => true, :confirmation => true
+ :characters => { :url_safe => true },
+ :whitespace => { :leading => false, :trailing => false }
+ validates :email, :presence => true, :confirmation => true, :characters => true