Skip to content

Commit 11c545a

Browse files
author
John Pinto
committed
Updated app/models/user.rb.
Changes: - Added Doorkeeper attributes for Access. - Added Email confirmation attributes. - Added User Notification attribute.
1 parent fac567d commit 11c545a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

app/models/user.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class User < ApplicationRecord
6868
:rememberable, :trackable, :validatable, :omniauthable, :confirmable,
6969
omniauth_providers: %i[shibboleth orcid]
7070

71+
##
72+
# User Notification Preferences
73+
serialize :prefs, Hash
74+
7175
# default user language to the default language
7276
attribute :language_id, :integer, default: -> { Language.default&.id }
7377

@@ -98,6 +102,10 @@ class User < ApplicationRecord
98102
has_and_belongs_to_many :notifications, dependent: :destroy,
99103
join_table: 'notification_acknowledgements'
100104

105+
has_many :access_grants, class_name: 'Doorkeeper::AccessGrant', foreign_key: :resource_owner_id, dependent: :delete_all
106+
107+
has_many :access_tokens, class_name: 'Doorkeeper::AccessToken', foreign_key: :resource_owner_id, dependent: :delete_all
108+
101109
# ===============
102110
# = Validations =
103111
# ===============
@@ -110,6 +118,9 @@ class User < ApplicationRecord
110118

111119
validates :org, presence: { message: PRESENCE_MESSAGE }
112120

121+
attr_accessor :email_confirmation
122+
validates :email, confirmation: { case_sensitive: false, message: "text field does not match" }
123+
113124
# ==========
114125
# = Scopes =
115126
# ==========

0 commit comments

Comments
 (0)