lib/ahoy_email/processor.rb in ahoy_email-0.3.2 vs lib/ahoy_email/processor.rb in ahoy_email-0.4.0

- old
+ new

@@ -8,11 +8,11 @@ @message = message @mailer = mailer end def process - safely do + Safely.safely do action_name = mailer.action_name.to_sym if options[:message] && (!options[:only] || options[:only].include?(action_name)) && !options[:except].to_a.include?(action_name) @ahoy_message = AhoyEmail.message_model.new ahoy_message.token = generate_token ahoy_message.to = Array(message.to).join(", ") if ahoy_message.respond_to?(:to=) @@ -29,17 +29,17 @@ ahoy_message.send("#{k}=", options[k.to_sym]) if ahoy_message.respond_to?("#{k}=") end ahoy_message.assign_attributes(options[:extra] || {}) - ahoy_message.save + ahoy_message.save! message["Ahoy-Message-Id"] = ahoy_message.id.to_s end end end def track_send - safely do + Safely.safely do if (message_id = message["Ahoy-Message-Id"]) && message.perform_deliveries ahoy_message = AhoyEmail.message_model.where(id: message_id.to_s).first if ahoy_message ahoy_message.sent_at = Time.now ahoy_message.save