Created
December 13, 2013 18:03
-
-
Save gschorkopf/7948462 to your computer and use it in GitHub Desktop.
Orders controller -> Worker -> Mailer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Version 1: | |
def perform(order_attributes, user_attributes, order_total) | |
UserMailer.order_confirmation(order_attributes, user_attributes, order_total).deliver | |
end | |
def order_confirmation(user_attributes, order_attributes, order_total) | |
@user = user_attributes | |
@order = order_attributes | |
@total = order_total | |
@url2 = 'http://fourth-meal.herokuapp.com' | |
mail(to: @user[:email], | |
subject: 'Thank you for your order!') | |
end | |
# Version 2: | |
def perform(order_id, user_id) | |
UserMailer.order_confirmation(order_id, user_id).deliver | |
end | |
def order_confirmation(order_id, user_id) | |
@user = User.find(user_id) | |
@order = Order.find(order_id) | |
mail(to @user.email, subject: "Thank you for your order!") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment