Reorder associations and validations

This commit is contained in:
Jeffrey Hardy
2024-09-19 13:56:05 -04:00
parent 97e6bf1fc5
commit 36ee7a8e75
+4 -3
View File
@@ -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) }