Create sdg manager

This commit is contained in:
taitus
2020-11-25 12:02:19 +01:00
committed by Javi Martín
parent 599332f26e
commit cd7185f317
6 changed files with 44 additions and 1 deletions

View 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

View File

@@ -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