DEV Community

Discussion on: Smarter Rails Services with Active Model Modules

Collapse
 
sophiedebenedetto profile image
Sophie DeBenedetto

Glad you found it helpful!

I included the final version of the PurchaseHandler service class towards the end of the post. I removed the #credit_card attr_reader as it wasn't being used. The #purchase attribute is set in the #create_purchase method.

Also keep in mind that the code for actually creating a purchase is not described here and isn't totally relevant--just an example to illustrate how we can use some of these super helpful Active Model modules :)