From 36ee7a8e75e72d201f68217516717bb887f70b94 Mon Sep 17 00:00:00 2001 From: Jeffrey Hardy Date: Thu, 19 Sep 2024 13:56:05 -0400 Subject: [PATCH] Reorder associations and validations --- app/models/user.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1f3373fae..67476768d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,9 +1,6 @@ class User < ApplicationRecord belongs_to :account - has_many :assignments - has_many :assigned, through: :assignments, source: :bubble - has_many :sessions, dependent: :destroy has_secure_password validations: false @@ -11,6 +8,10 @@ class User < ApplicationRecord has_many :projects, through: :accesses has_many :bubbles, through: :projects + has_many :assignments + has_many :assigned_bubbles, through: :assignments, source: :bubble + + validates_presence_of :email_address normalizes :email_address, with: ->(value) { value.strip.downcase } scope :active, -> { where(active: true) }