Create sdg manager
This commit is contained in:
6
app/models/sdg/manager.rb
Normal file
6
app/models/sdg/manager.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class SDG::Manager < ApplicationRecord
|
||||
belongs_to :user, touch: true
|
||||
delegate :name, :email, to: :user
|
||||
|
||||
validates :user_id, presence: true, uniqueness: true
|
||||
end
|
||||
@@ -15,6 +15,7 @@ class User < ApplicationRecord
|
||||
has_one :moderator
|
||||
has_one :valuator
|
||||
has_one :manager
|
||||
has_one :sdg_manager, class_name: "SDG::Manager", dependent: :destroy
|
||||
has_one :poll_officer, class_name: "Poll::Officer"
|
||||
has_one :organization
|
||||
has_one :lock
|
||||
@@ -197,6 +198,10 @@ class User < ApplicationRecord
|
||||
manager.present?
|
||||
end
|
||||
|
||||
def sdg_manager?
|
||||
sdg_manager.present?
|
||||
end
|
||||
|
||||
def poll_officer?
|
||||
poll_officer.present?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user