- :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 => I18n.t("users.account.invalid chars", invalid_chars: INVALID_CHARS) }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\A\S/, :message => I18n.t("users.account.leading whitespace") }
- validates :display_name, :if => proc { |u| u.display_name_changed? },
- :format => { :with => /\S\z/, :message => I18n.t("users.account.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