Last active
November 26, 2018 07:23
-
-
Save StevenJL/fd54686c8aa66e343e15b77f9b842e8e to your computer and use it in GitHub Desktop.
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
class CompleteOrder | |
def perform | |
notify_recipient(order.recipient) | |
update_inventory(order.item_number) | |
prepare_shippping(order.shipping_address) | |
end | |
private | |
def order | |
# cache the query for order as an instance variable | |
# since it is accessed multiple times in the #perform method | |
@order ||= Order.find_by(id: @order_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment