Skip to content

Have class-methods for options rather than per-method #23

@nuclearspike

Description

@nuclearspike

Unless I'm missing it, it would be very handy to be able to set some of these options at the controller level rather than for each method like the way the (apparently abandoned) 'sendgrid' gem does it. Then you can override the option in the methods if you want. I'd like to set up opentracking for everything, for example.

class MyMailer < ActionMailer::Base
  include SendGrid
  sendgrid_category :use_subject_lines
  sendgrid_enable   :ganalytics, :opentrack
  sendgrid_unique_args :key1 => "value1", :key2 => "value2"

  def welcome_message(user)
    sendgrid_category "Welcome"
    sendgrid_unique_args :key2 => "newvalue2", :key3 => "value3"
    mail :to => user.email, :subject => "Welcome #{user.name} :-)"
  end

  def goodbye_message(user)
    sendgrid_disable :ganalytics
    mail :to => user.email, :subject => "Fare thee well :-("
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions