Class: Spree::MailerPreviews::OrderPreview

Inherits:
ActionMailer::Preview
  • Object
show all
Defined in:
lib/spree/mailer_previews/order_preview.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) cancel



10
11
12
13
14
# File 'lib/spree/mailer_previews/order_preview.rb', line 10

def cancel
  order = Order.with_state(:canceled).last
  raise "Your database needs at least one cancelled order to render this preview" unless order
  OrderMailer.cancel_email(order)
end

- (Object) confirm



4
5
6
7
8
# File 'lib/spree/mailer_previews/order_preview.rb', line 4

def confirm
  order = Order.complete.last
  raise "Your database needs at least one completed order to render this preview" unless order
  OrderMailer.confirm_email(order)
end

- (Object) inventory_cancellation



16
17
18
19
20
# File 'lib/spree/mailer_previews/order_preview.rb', line 16

def inventory_cancellation
  order = Spree::Order.joins(:inventory_units).merge(Spree::InventoryUnit.canceled).last
  raise "Your database needs at least one order with a canceled inventory unit to render this preview" unless order
  OrderMailer.inventory_cancellation_email(order, [order.inventory_units.first])
end