diff --git a/app/mailers/policy_manager/portability_mailer.rb b/app/mailers/policy_manager/portability_mailer.rb index 4f92c31..812e105 100644 --- a/app/mailers/policy_manager/portability_mailer.rb +++ b/app/mailers/policy_manager/portability_mailer.rb @@ -3,7 +3,7 @@ class PortabilityMailer < ApplicationMailer def progress_notification(portability_request_id) @portability_request = PortabilityRequest.find(portability_request_id) - @user = User.find(@portability_request.user_id) + @user = Config.user_resource.find(@portability_request.user_id) opts = { :to => @user.email, :subject => I18n.t("terms_app.mails.progress.subject") } opts.merge!({ @@ -18,7 +18,7 @@ def progress_notification(portability_request_id) def completed_notification(portability_request_id) @portability_request = PortabilityRequest.find(portability_request_id) - @user = User.find(@portability_request.user_id) + @user = Config.user_resource.find(@portability_request.user_id) @link = @portability_request.download_link opts = { :to => @user.email, :subject => I18n.t("terms_app.mails.completed.subject") } @@ -33,7 +33,7 @@ def completed_notification(portability_request_id) end def admin_notification(user_id) - @user = User.find(user_id) + @user = Config.user_resource.find(user_id) opts = { :to => Config.admin_email(@user), :subject => I18n.t("terms_app.mails.admin.subject", email: @user.email) } opts.merge!({ diff --git a/app/models/policy_manager/portability_request.rb b/app/models/policy_manager/portability_request.rb index ea1a4ef..102b979 100644 --- a/app/models/policy_manager/portability_request.rb +++ b/app/models/policy_manager/portability_request.rb @@ -5,7 +5,7 @@ module PolicyManager class PortabilityRequest < ApplicationRecord include Paperclip::Glue - belongs_to :user + belongs_to :user, class_name: Config.user_resource.to_s has_attached_file :attachment, path: Config.exporter.try(:attachment_path) || Rails.root.join("tmp/portability/:id/build.zip").to_s, diff --git a/app/models/policy_manager/user_term.rb b/app/models/policy_manager/user_term.rb index 3136f12..bfaa177 100644 --- a/app/models/policy_manager/user_term.rb +++ b/app/models/policy_manager/user_term.rb @@ -4,7 +4,7 @@ module PolicyManager class UserTerm < ApplicationRecord include AASM - belongs_to :user + belongs_to :user, class_name: Config.user_resource.to_s belongs_to :term validates_uniqueness_of :term_id, :scope => :user_id