From 8d4bdcb2eff18006d979bcd435e29d03fd1cca1b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 18:17:32 -0500 Subject: [PATCH] WHOOPS -- fix user signup --- app/models/user.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3bd5ee87..a30c3da3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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