Agreed on keeping it background agnostic. My thought wasn't necessarily DJ-specific but whether we want to pass the mailer around the controller or the `user` / `@user`.

In that example, when we store the `Delayed::Job` record in the database, would we be serializing an `ActionMailer` object with a `user` ActiveRecord object referenced inside it? We have a guideline against doing that:

> Store IDs, not ActiveRecord objects for cleaner serialization, then re-find the ActiveRecord object in the perform method.

We also have some style guidelines:

> Define a PRIORITY constant at the top of delayed job classes.
> Define two public methods: self.enqueue and perform.
> Put delayed job classes in app/jobs.

So a likely implementation for a thoughtbot app might be:

```ruby
# app/controllers/passwords_controller.rb
class PasswordsController < Clearance::PasswordsController
  private

  def deliver_email
    ResetPasswordJob.enqueue(@user)
  end
end

# app/jobs/reset_password_job.rb
class ResetPasswordJob < Struct.new(:user_id)
  PRIORITY = 1

  def self.enqueue(user)
    Delayed::Job.enqueue(new(user.id), priority: PRIORITY)
  end

  def perform
    ClearanceMailer.change_password(user).deliver
  end

  private

  def user
    User.find(user_id)
  end
end
```

Those looking for something simpler might do:

```ruby
# app/controllers/passwords_controller.rb
class PasswordsController < Clearance::PasswordsController
  private

  def deliver_email
    ClearanceMailer.delay.change_password(user)
  end
end
```

I'm curious now about how the `delay` method in `Delayed::Job` serializes the mailer and its parameters.