I have my app and it has username column. For user input, I'd like to make this column with validation.
username has to contain only the characters below
abcdefghijklmnopqrstuvwxyz0123456789
Use a format validator:
validates :username, format: { with: /\A[a-z0-9]+\z/ }
https://guides.rubyonrails.org/v3.2/active_record_validations_callbacks.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With