Resources

Summary

# bash
rails generate job contact_mailer

# app/jobs/contact_mailer_job.rb
  class ContactMailerJob < ActiveJob::Base
    queue_as :default

    def perform(from,subject,message)
      ContactMailer.send_contact(from,subject,message)
    end
  end

# visitors_controller.rb
  ContactMailerJob.perform_later(from,subject,message)

# Gemfile
  gem 'daemons'
  gem 'delayed_job'
  gem 'delayed_job_active_record'
  gem 'whenever', require: false

# bash
  rails generate delayed_job:active_record
  rake db:migrate

# config/application.rb
  config.active_job.queue_adapter = :delayed_job

# config/schedule.rb
  every :reboot do
    #`bin/delayed_job -n2 start`
    command 'bin/delayed_job -n2 start'
  end

# bash
  whenever -help
  whenever -w
  crontab -l