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_callbacks
isn't wrapping the contents of#create_purchase
as well?In the ProductQualityValidator there's
product.id
; did you meanproduct_data[:id]
? Thewhere
should befind_by
to 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_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 theProductQualityValidator
. Thanks!