Skip to content

Instantly share code, notes, and snippets.

@rocodev-tech
Created June 22, 2014 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rocodev-tech/88ac60f9296e55a74798 to your computer and use it in GitHub Desktop.
Save rocodev-tech/88ac60f9296e55a74798 to your computer and use it in GitHub Desktop.
class OrderPlacingService
def initialize(cart,order)
@order = order
@cart = cart
end
def place_order!
@order.build_item_cache_from_cart(@cart)
@order.calculate_total!(@cart)
@cart.clear!
OrderMailer.notify_order_placed(@order).deliver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment