David Aldridge


20 Experience
0 Lessons Completed
0 Questions Solved


Super nice!

And since the enum has created scopes for billing and shipping, you can DRY those associations up a little with:

has_one :billing_address,  -> { merge(Address.billing) }, class_name: "Address"
has_one :shipping_address, -> { merge(Address.shipping) }, class_name: "Address"
logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.