Engineer at GitHub, graduate of + former teacher at Flatiron School. Cat lover, but I admit I have a dog. Supporting students and junior devs through https://www.break-in.tech/
Ah yes run_callbacks should absolutely be used in the #create_purchase method! Thanks for bringing that up. The post has been update to reflect that, along with your suggestions for the ProductQualityValidator. Thanks!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm curious why
run_callbacksisn't wrapping the contents of#create_purchaseas well?In the ProductQualityValidator there's
product.id; did you meanproduct_data[:id]? Thewhereshould befind_byto get a single object back.Great article! One of the more convincing takes on Ruby service objects for Rails. The callbacks do feel pretty clunky though.
Hi there,
Ah yes
run_callbacksshould absolutely be used in the#create_purchasemethod! Thanks for bringing that up. The post has been update to reflect that, along with your suggestions for theProductQualityValidator. Thanks!