WHOOPS -- fix user signup

This commit is contained in:
Andrew Brown 2019-03-11 18:17:32 -05:00
parent d18ad1db12
commit 8d4bdcb2ef

View File

@ -11,9 +11,12 @@ class User < ApplicationRecord
include HasContent
include Authority::UserAbilities
validates_uniqueness_of :username, allow_nil: true, allow_blank: true
validates_format_of :username, with: /\A[A-Za-z0-9\-_\$\+\!\*]+\z/, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)'
validates :username, length: { in: 0..40, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)' }
validates :username,
uniqueness: true,
allow_nil: true,
allow_blank: true,
length: { maximum: 40 },
format: /\A[A-Za-z0-9\-_\$\+\!\*]+\z/
has_many :subscriptions, dependent: :destroy
has_many :billing_plans, through: :subscriptions