lib/ahoy_email.rb in ahoy_email-0.1.2 vs lib/ahoy_email.rb in ahoy_email-0.1.3

- old
+ new

@@ -7,11 +7,11 @@ require "ahoy_email/interceptor" require "ahoy_email/mailer" require "ahoy_email/engine" module AhoyEmail - mattr_accessor :secret_token, :options + mattr_accessor :secret_token, :options, :subscribers self.options = { message: true, open: true, click: true, @@ -19,11 +19,14 @@ utm_source: proc {|message, mailer| mailer.mailer_name }, utm_medium: "email", utm_term: nil, utm_content: nil, utm_campaign: proc {|message, mailer| mailer.action_name }, - user: proc{|message, mailer| User.where(email: message.to.first).first rescue nil } + user: proc{|message, mailer| (message.to.size == 1 ? User.where(email: message.to.first).first : nil) rescue nil }, + mailer: proc{|message, mailer| "#{mailer.class.name}##{mailer.action_name}" } } + + self.subscribers = [] def self.track(options) self.options = self.options.merge(options) end