phase002 complete
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class User < ApplicationRecord
|
||||
has_many :fuel_entries, foreign_key: :updated_by_user_id, dependent: :restrict_with_error, inverse_of: :updated_by_user
|
||||
has_many :maintenance_entries, foreign_key: :updated_by_user_id, dependent: :restrict_with_error, inverse_of: :updated_by_user
|
||||
|
||||
before_validation :normalize_email
|
||||
|
||||
validates :name, presence: true
|
||||
validates :email, presence: true, uniqueness: { case_sensitive: false }
|
||||
|
||||
private
|
||||
|
||||
def normalize_email
|
||||
self.email = email.to_s.strip.downcase if email.present?
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user