Files
openfoodnetwork/app/mailers/spree/shipment_mailer.rb
Maikel Linke ced49e0217 Apply Rails standard to base mailer class
It has the advantage that `rails generate mailer` works out of the box
and we comply with rubocop rules.
2023-04-12 16:39:20 +10:00

20 lines
565 B
Ruby

# frozen_string_literal: true
module Spree
class ShipmentMailer < ApplicationMailer
def shipped_email(shipment, delivery:)
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
@delivery = delivery
subject = base_subject
mail(to: @shipment.order.email, subject: subject)
end
private
def base_subject
default_subject = !@delivery ? t('.picked_up_subject') : default_i18n_subject
"#{@shipment.order.distributor.name} #{default_subject} ##{@shipment.order.number}"
end
end
end