Skip to content

Commit

Permalink
mailers & AR relations with engine Configured user_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed May 7, 2018
1 parent 106e9cd commit 26463f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/mailers/policy_manager/portability_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!({
Expand All @@ -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") }
Expand All @@ -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!({
Expand Down
2 changes: 1 addition & 1 deletion app/models/policy_manager/portability_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/models/policy_manager/user_term.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26463f9

Please sign in to comment.