Correct :username validate format

This commit is contained in:
Carl Chenet 2017-05-20 15:34:34 +02:00
parent 0fccf79089
commit 7f5114d0f1

View file

@ -57,7 +57,7 @@ class User < ActiveRecord::Base
VALID_USERNAME = /[A-Za-z0-9][A-Za-z0-9_-]{0,24}/
validates :username,
:format => { :with => /\A#{VALID_USERNAME}\Z/ },
:format => { :with => /\A#{VALID_USERNAME}\z/ },
:uniqueness => { :case_sensitive => false }
validates_each :username do |record,attr,value|