Reorder associations and validations
This commit is contained in:
+4
-3
@@ -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) }
|
||||
|
||||
Reference in New Issue
Block a user