Class: OrderMailer
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- OrderMailer
- Defined in:
- app/mailers/order_mailer.rb
Overview
You can render different mailer views based on the order subclass. Views should be in the form of “confirmation_for_(order_subclass)” For example, RefundOrder will automatically render confirmation_for_refund
If no view is found (there isn’t one for BoxOffice::Order, for example) then defaults to confirmaiton_for
Instance Method Summary collapse
Instance Method Details
#confirmation_for(order) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/mailers/order_mailer.rb', line 13 def confirmation_for(order) @order = order @person = order.person = Hash.new.tap do |o| o[:to] = @person.email o[:from] = from(@order) o[:subject] = "Your Order" if order.contact_email.present? o[:reply_to] = order.contact_email end o[:template_name] = template_name_for(order) end if order.pdf.present? && (@order.organization.can? :access, :scannable_tickets) ['tickets.pdf'] = attached_pdf(order) end mail() end |