File: auto_mailer.rb

package info (click to toggle)
ruby-roadie-rails 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,280 kB
  • sloc: ruby: 1,670; sh: 47; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

class AutoMailer < ActionMailer::Base
  include Roadie::Rails::Automatic

  default from: "john@example.com"

  def normal_email
    generate_email
  end

  def disabled_email
    generate_email
  end

  private

  def roadie_options
    unless /disabled/.match?(action_name)
      super.combine(url_options: {protocol: "https"})
    end
  end

  def generate_email
    mail(to: "example@example.org", subject: "Notification for you") do |format|
      format.html { render :normal_email }
      format.text { render :normal_email }
    end
  end
end