We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 209deeb commit f44b3dfCopy full SHA for f44b3df
app/models/user.rb
@@ -3,6 +3,7 @@ class User < ApplicationRecord
3
4
DEFAULT_FOLDER_NAME = 'My First Folder'.freeze
5
BIO_MISSING_TEXT = "This user hasn't updated their bio yet."
6
+ ALPHANUMERIC = /\A[a-zA-Z0-9]*\z/.freeze
7
8
has_one_attached :avatar
9
@@ -33,7 +34,7 @@ class User < ApplicationRecord
33
34
#TODO: Add tests for this
35
after_create :create_default_folder
36
- validates :name, presence: true, length: { maximum: 50 }
37
+ validates :name, presence: true, length: { maximum: 50 }, format: { with: ALPHANUMERIC }
38
validates :bio, length: { maximum: 160 }
39
validates :location, length: { maximum: 30 }
40
0 commit comments