Sha256: 4b7d9529bd9270f2550dff8981c51f1ae11c919a70a235e51b86e25904aa4db3

Contents?: true

Size: 881 Bytes

Versions: 17

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

module Emailbutler
  module Mailers
    module Helpers
      extend ActiveSupport::Concern
      include Emailbutler::Helpers

      included do
        after_action :save_emailbutler_message
      end

      private

      def process_action(*args)
        build_emailbutler_message(args)

        super
      end

      def build_emailbutler_message(args)
        @emailbutler_message = Emailbutler.build_message(
          mailer: self.class.to_s,
          action: action_name,
          params: serialize({ mailer_params: params, action_params: args[1..] }, false)
        )
      end

      def save_emailbutler_message
        message.message_id = @emailbutler_message.uuid
        Emailbutler.set_message_attribute(@emailbutler_message, :send_to, message.to)
        Emailbutler.save_message(@emailbutler_message)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
emailbutler-0.8.8 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.7 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.6 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.5 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.4 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.3 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.2 lib/emailbutler/mailers/helpers.rb
emailbutler-0.8.1 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.6 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.5 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.4 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.3 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.2 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.1 lib/emailbutler/mailers/helpers.rb
emailbutler-0.7.0 lib/emailbutler/mailers/helpers.rb
emailbutler-0.6.1 lib/emailbutler/mailers/helpers.rb
emailbutler-0.6.0 lib/emailbutler/mailers/helpers.rb