Aarthi
Aarthi

Reputation: 1521

Filtering params in rails active jobs

I am creating background job for sending registration email to the user after they have been created an account, I am using devise for authentication, I am enqueuing a job RegistrationMailer.send_login_credentials(self, password).deliver_later at user model (as there is no way to get the password after save I need to send password as parameter to active job while enqueue a mailer job), But the parameters are getting printed while enqueuing and while processing the job, Is there any way to filter these password parameter, Or any safer way to do this?

Upvotes: 0

Views: 567

Answers (1)

kiddorails
kiddorails

Reputation: 13014

Create an initializer config/initializers/active_job_patch.rb and patch the args_info metjhod to not print the arguments.

require 'active_job/logging'
class ActiveJob::Logging::LogSubscriber
  private def args_info(job)
    ''
  end
end

Upvotes: 1

Related Questions